graphql-query icon indicating copy to clipboard operation
graphql-query copied to clipboard

Spec does not allow for parsing a fragment only query

Open fbielejec opened this issue 6 years ago • 0 comments

Reads/ updates to cache often require using [fragments].(https://www.apollographql.com/docs/react/caching/cache-interaction/#readfragment). Currently the entry-point function does not allow for parsing only a fragment, this won;t conform to schema:

(graphql-query {:fragments [{:fragment/name :fragment/followFields
                                              :fragment/type :User
                                              :fragment/fields [:user/is-followed :user/followers-count]}]})

it is possible to still generate the gql fragment by passing a manually conformed map:

(fragment-str {:fragment/name :fragment/followFields
                       :fragment/type :User
                       :fragment/fields [[:graphql-query/field :user/is-followed] [:graphql-query/field :user/followers-count]]})

But it should be supported "natively".

fbielejec avatar Nov 07 '19 11:11 fbielejec