Skip to content

Instantly share code, notes, and snippets.

@olegkalyta
Created April 24, 2018 15:20
Show Gist options
  • Save olegkalyta/24a30e16c0f1b2f58fe254bcb05da068 to your computer and use it in GitHub Desktop.
Save olegkalyta/24a30e16c0f1b2f58fe254bcb05da068 to your computer and use it in GitHub Desktop.
const SingleRule = new GraphQLObjectType({
name: 'SingleRule',
description: 'Single validation rule',
fields: () => ({
id: {
type: GraphQLID,
description: 'ID of rule'
},
fieldName: {
type: GraphQLString,
description: 'Field that should be validated'
},
validationType: {
type: RuleType
},
rules: new GraphQLList(SingleRule)
}),
})
const Rules = new GraphQLObjectType({
name: 'RuleTypeSchema',
description: 'Validation Rule Type',
fields: {
rules: {
type: new GraphQLList(SingleRule),
resolve: () => {
return [
{
fieldName: 'firstName',
validationType: 'all',
rules: [],
}
]
}
},
}
})
@olegkalyta
Copy link
Author

{
  "errors": [
    {
      "message": "The type of SingleRule.rules must be Output Type but got: undefined."
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment