Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Type validation when using variables #2

@IcanDivideBy0

Description

@IcanDivideBy0

Hello,
When using variables in query, the inputType never get validated.
Assuming we're using your Star Wars schema, the following will work, whatever the side input in variables :

var HeroInputType = UnionInputType({
    name: 'hero',
    inputTypes: [JediInputType, SithInputType], //an object can be used instead to query by names other than defined in these types
    typeKey: 'side'
});

[...]

graphql(Schema, `
  mutation($hero: HeroInputType!) {
    hero(input: $hero) {
      ...
    }
  }
`, {}, {}, {
  hero: {
    side: 'WHATEVER'
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions