Skip to content

SDL Validation Prior to Schema Creation #2944

Open
@Cito

Description

@Cito

Recently the issue was raised for the Python port graphql-core that enum values aren't validated against their defintion when they are used as default arguments SDL. This is the example that was given:

const sdl = `
enum Role {
  ADMIN
  USER
}

type Query {
  hello(r: Role = ADMIN): String
  complex(i: Test = { role: DOES_NOT_EXIST }): String
  complexAlt(i: Test): String
}

input Test {
  ignore: String
  role: Role = INVALID
}
`

const schema = graphql.buildASTSchema(graphql.parse(sdl))

const fields = schema.getType('Query').getFields()
const arg1 = fields.hello.args[0]
const arg2 = fields.complex.args[0]

console.log(arg1, arg2)

Should schema validation not show this is an error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions