NAME
GraphQL::Type::Library - GraphQL type library
SYNOPSIS
use GraphQL::Type::Library -all;
has name => (is => 'ro', isa => StrNameValid, required => 1);
DESCRIPTION
Provides Type::Tiny types.
TYPES
StrNameValid
If called with a string that is not a valid GraphQL name, will throw an exception. Suitable for passing to an isa
constraint in Moo.
ValuesMatchTypes
Subtype of "HashRef" in Types::Standard, whose values are hash-refs. Takes two parameters:
- value keyname
-
Optional within the second-level hashes.
- type keyname
-
Values will be a GraphQL::Type. Mandatory within the second-level hashes.
In the second-level hashes, the values (if given) must pass the GraphQL type constraint.
FieldMapInput
Hash-ref mapping field names to a hash-ref description. Description keys, all optional except type
:
- type
-
GraphQL input type for the field.
- default_value
-
Default value for this argument if none supplied. Must be same type as the
type
(implemented with type "ValuesMatchTypes". - description
-
Description.
FieldMapOutput
Hash-ref mapping field names to a hash-ref description. Description keys, all optional except type
:
- type
-
GraphQL output type for the field.
- args
- resolve
-
Code-ref to return a given property from a given source-object.
- subscribe
-
Code-ref to return a given property from a given source-object.
- deprecation_reason
-
Reason if deprecated. If given, also sets a boolean key of
is_deprecated
to true. - description
-
Description.
Int32Signed
32-bit signed integer.
ArrayRefNonEmpty
Like "ArrayRef" in Types::Standard but requires at least one entry.
UniqueByProperty
An ArrayRef, its members' property (the one in the parameter) can occur only once.
use Moo;
use GraphQL::Type::Library -all;
has types => (
is => 'ro',
isa => UniqueByProperty['name'] & ArrayRef[InstanceOf['GraphQL::Type::Object']],
required => 1,
);
ExpectObject
A Maybe[HashRef]
that produces a GraphQL-like message if it fails, saying "found not an object".
AUTHOR
Ed J, <etj at cpan.org>