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
Another option would be to add a :variable/required? key to the variable map but I personally dislike this option as the required-property is part of the type and not the variable definition.
List
GraphQL:
queryFoo($Foo:[Int!]!){employee{name}}
Variables:
[{:variable/name"Foo":variable/type {:type/kind:list;; :type/kind instead of :type/type!:type.list/items {:type/type:Int:type/required?true}
:type/required?true}}]
I do not particulary like the :type/kind declaration as there is only one valid value (:list) for it but I do not see another nice way to do so. I mislike the idea to add a special :type/type called :List as it is not reserved by the GraphQL specification (as far as I can see) and someone may add a custom :List type to their schema and then this will break.
Final remarks
According to the GraphQL specification this are the only valid options for the variable types.
Implementation
@r0man already implemented a way to add Lists as types here but it misses following patterns (when I read the code correctly): [Int]!, [[Int]] and so on.
I will provide an implemenation (and create a PR) as soon as possible but would be happy for any feedback for this solution approach.
The text was updated successfully, but these errors were encountered:
I cross-posted this issue at the seemingly most-active fork https://github.com/district0x/graphql-query as this repository seems to be dead. Issue: district0x/graphql-query#4
Currently the spec describes allows to be a
:variable/type
to be only akeyword
:This works fine in many cases but is for our use case a serious limitation.
I would propose to add functionality to suport all valid GraphQL input types as described in the GraphQL Spec.
Here are some examples:
I will use following query as an example (and modify it accordingly):
The corresponding Venia query (as it works now without problems) is:
I will focus now only on the
:venia/variables
part:Simple variable
GraphQL:
Variables:
Required variable
GraphQL:
Variables:
Another option would be to add a
:variable/required?
key to the variable map but I personally dislike this option as therequired
-property is part of the type and not the variable definition.List
GraphQL:
Variables:
I do not particulary like the
:type/kind
declaration as there is only one valid value (:list
) for it but I do not see another nice way to do so. I mislike the idea to add a special:type/type
called:List
as it is not reserved by the GraphQL specification (as far as I can see) and someone may add a custom:List
type to their schema and then this will break.Final remarks
According to the GraphQL specification this are the only valid options for the variable types.
Implementation
@r0man already implemented a way to add Lists as types here but it misses following patterns (when I read the code correctly):
[Int]!
,[[Int]]
and so on.I will provide an implemenation (and create a PR) as soon as possible but would be happy for any feedback for this solution approach.
The text was updated successfully, but these errors were encountered: