Skip to content

Usage of Input in List does not count as usage #261

Closed as duplicate
Closed as duplicate

Description

@nidomiro

With a schema like the following I get the error that ReferenceSportsClassInput is not of type GraphQLInputType, but it clearly is.

Debugging into com.coxautodev.graphql.tools.SchemaParser shows, that ReferenceSportsClassInput is listed in scanResult.unusedDefinitions and not in scanResult.definitions .

Referencing ReferenceSportsClassInput in another input directly (not as List) fixes the problem for the list-reference.

Schema:

type Mutation {
    createPerson(input: CreatePersonInput!): Person!
}

type Person {
    id: ID!
    firstName: String!
    name: String!
    displayName: String!
    birthDate: String!
    emailAddress: String!
    phoneNumber: String
    postalAddress: PostalAddress!
    sportsClasses(page:Int! = 0, pageSize: Int! = 50): SportsClassPage!
}

input CreatePersonInput {
    firstName: String!
    name: String!
    displayName: String!
    birthDate: String!
    emailAddress: String!
    phoneNumber: String
    postalAddress: PostalAddressInput!
    sportsClasses: [ReferenceSportsClassInput!]
}

input ReferenceSportsClassInput {
    id: ID!
}
[...]

Exception:

Caused by: com.coxautodev.graphql.tools.SchemaError: Expected type 'ReferenceSportsClassInput' to be a GraphQLInputType, but it wasn't!  Was a type only permitted for object types incorrectly used as an input type, or vice-versa?
	at com.coxautodev.graphql.tools.SchemaParser.determineType(SchemaParser.kt:335)
	at com.coxautodev.graphql.tools.SchemaParser.determineType(SchemaParser.kt:328)
	at com.coxautodev.graphql.tools.SchemaParser.determineType(SchemaParser.kt:327)
	at com.coxautodev.graphql.tools.SchemaParser.determineInputType(SchemaParser.kt:323)

Lib-versions:
com.graphql-java-kickstart:graphql-spring-boot-starter:5.7.3
com.graphql-java-kickstart:graphql-java-tools:5.5.2

Activity

  1. kemsar commented on Oct 23, 2019

    @kemsar

    Same issue, tools v. 5.6.1. @nidomiro , have you found a solution?

  2. nidomiro commented on Nov 1, 2019

    @nidomiro
    Author

    Unfortunately not. My workaround is to create a dummy-Query and reference the type here explicitly.

  3. oryan-block commented on Oct 3, 2026

    @oryan-block
    Collaborator

    Closing as a duplicate of #479. List-only nested inputs work on 14.x when the input class has a matching public property (covered in NestedInputTypesTest). The remaining failure, when there is no matching property or the parameter is a Map, is #479. The misleading error message is #422.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions