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
@rawkode There is no specialized function for astFromValue and isValidJSValue are intended to work with Input types only.
The resolution of output types heavily depends on resolvers so output data is validated only during query execution.
What you can do is to use graphql:
consttestSchema=newGraphQLSchema({query: newGraphQLObjectType({name: 'Query',fields: {testField: {type: newGraphQLList(schema.getType('SomeType')),}}});})constsource=` { testField { someField # All other subfields } }`;constresult=graphqlSync({schema: testSchema, source,rootValue: members});expect(result.errors).to.equal(undefined);expect(result.data.testField).to.deep.equal(members);
Disclaimer: I didn't run this code just wrote it from the top of my head.
Is it possible to validate a JSON document against a GraphQL Output Type?
I found these docs: https://graphql.org/graphql-js/utilities/
I am able to load the schema and get the types. I can't work out how to validate a JSON doc against one of those types though.
I've tried
astFromValue
andisValidJSValue
; both without success.Please help :)
This is where I am thus far:
The text was updated successfully, but these errors were encountered: