Skip to content

Missing/incorrect fragment condition validation on union properties #697

Description

@stuebingerb

This is #683, except for union properties that have their own custom implementation.

For the following schema:

type Actor {
  age: Int!
  favourite: MovieUnion!
  name: String!
}

type Director {
  age: Int!
  favActors: [Actor!]!
  name: String!
}

type Film {
  director: Director!
  title: String!
  type: FilmType!
  year: Int!
}

type Query {
  actors: [Actor!]!
}

union MovieUnion = Actor | Film

enum FilmType {
  FULL_LENGTH
  SHORT_LENGTH
}

KGraphQL successfully executes the following query:

{
    actors {
        name
        favourite {
            ... on Actor { name }
            ... on FilmType { illegal }
            ... on Director { name }
            ... on MissingType { foo }
            ... on String { bar }
        }
    }
}

Where Director is a legal type but not a member of MovieUnion, FilmType is an enum, MissingType is not even part of the schema, and String is a scalar.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions