You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Concurrently with #17, we should investigate adding phantom type parameters to ObjectType and SelectionSpec representing a type marker corresponding to a type from the target schema:
type ObjectType schemaType
=ObjectTypetype SelectionSpec schemaType selectionType result vars
=SelectionSpecAST.Selection(AST.SelectionSet->Decoder result)(List(Variable vars))(ListAST.FragmentDefinitionInfo)
This would allow each module that provides helper functions for an object/interface/union type to constrain those functions such that they only operate in correct ways according to the source schema. For example:
moduleSchema.Types.Userexposing (..)
importGraphQL.Request.Builderexposing (..)
importSchema.TypesasTypesname:SelectionSpecTypes.UserStringvarsname =
field "name"[] string
projects:List(String,Arg.Value vars )->ValueSpecNonNull(ObjectTypeTypes.Project) result vars
->SelectionSpecTypes.User(List result) vars
projects args projectSpec =
field "projects" args (list projectSpec)
The text was updated successfully, but these errors were encountered:
Note: instead of adding this parameter to ObjectType, it may be preferable to add it to ValueSpec, and allow it for non-object types as well.
jamesmacaulay
changed the title
Add type parameter to ObjectType to allow schema type constraints
Add type parameter to allow schema type constraints
Oct 14, 2017
jamesmacaulay
changed the title
Add type parameter to allow schema type constraints
Add type parameters to allow schema type constraints
Oct 14, 2017
jamesmacaulay
changed the title
Add type parameters to allow schema type constraints
Add type parameters to allow for schema type constraints
Oct 14, 2017
Concurrently with #17, we should investigate adding phantom type parameters to
ObjectType
andSelectionSpec
representing a type marker corresponding to a type from the target schema:This would allow each module that provides helper functions for an object/interface/union type to constrain those functions such that they only operate in correct ways according to the source schema. For example:
The text was updated successfully, but these errors were encountered: