Skip to content

Recursive input type breaks if wrapped in a list #36

Closed

Description

@kaqqao

The following scenario seems to break:

type Query {
    allLinks(filter: LinkFilter): [Link]
}

input LinkFilter {
    OR: [LinkFilter!]
    description_contains: String
    url_contains: String
}

And the LinkFilter POJO:

public class LinkFilter {

    private List<LinkFilter> OR;
    private String description_contains;
    private String url_contains;

    //getters & setters
}

The exceptions is:

com.coxautodev.graphql.tools.SchemaClassScannerError: Two different classes used for type LinkFilter:
- class com.something.LinkFilter:
| parameter 0 of method public java.util.List com.something.Query.allLinks(com.something.LinkFilter)
- interface java.util.List:
| input object InputValueDefinition{name='OR', type=ListType{type=NonNullType{type=TypeName{name='LinkFilter'}}}, defaultValue=null, directives=[]}

If I unwrap the OR field to just a LinkFilter, everything is fine.

Activity

  1. apottere commented on Jul 9, 2017

    @apottere
    Collaborator
  2. kaqqao commented on Jul 9, 2017

    @kaqqao
    Author

    I gave fixing this a shot at #37, but it's my first time seeing Kotlin (or this code-base) so...
    Feel free to reject and rewrite if it's bad. I ticked "allow edits from maintainers" in case you find some value in it.

    Not sure, if you saw my Gitter message. The TLDR version is: I'm writing a tutorial for a new GraphQL learning portal by Graph.cool and used this lib in all the examples and the sample project in the Java track. The deadline is in 2 days, so I was trying to get this fix in time if possible. If not, I'll try working around this issue in the examples somehow.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions