Closed EdmundsEcho closed 6 years ago
An annotation is not part of anyone's schema, and can only be used with another type (builtin or part of the user's schema).
example: [Boolean]!
On the other hand an object definition is simply a Type definition.
Thank you for your response. I'm confused by how [Boolean]!
, a gql schema
specification, is "not part of anyone's schema". Can you tell me more about what you mean? Are you saying the !
indicating non-null, is an example "Annotated"?... and "can only be used with another type".
Yes, !
is an example of an annotation, same as the brackets for a List ([]
).
This means that [Boolean]!
is of type AnnotatedType a
where a can be either an InputType
or a GType
.
Besides, there are two different kind of graphQL types here, the Builtin
types which are part of graphQL itself, (e.g. Boolean
, String
etc), and there are custom types (e.g. for non input types: DefinedType TypeDefinition
versus BuiltinType Builtin
).
"not part of anyone's schema" only means that the definition of Boolean, String, Int etc is baked in with graphQL itself, if by schema I meant the set of all type definitions of a given graphQL user, then it's not part of anyone's schema, it's part of the library itself.
Hope this helps.
An then to precise the answer of your original question:
My apologies for the question. I've worked with the library for a couple of months now and have missed the point of the two class definitions:
HasObjectDefinition
andHasAnnotatedType
.Do we only use
HasAnnotatedType
when we want to specify that our object can be null? And if so, required when our type is wrapped byMaybe
?(in non-Haskell implementations, it is a definition to specify non-null)
Thank you in advance for clarifying.