Skip to content

Support for input type having a list of complex input type ? #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
joel-costigliola opened this issue Apr 11, 2017 · 10 comments
Closed

Comments

@joel-costigliola
Copy link

Hi,

I would like to know if the annotations supports introspecting a List of complex input type.

Here's (simplified) example of what I'm trying to achieve which leads to a Introspection must provide input type for arguments error in chrome GraphiQL client .

I wonder if I'm doing something wrong or if there is no support of list of complex input types through annotations.

The SpaceInstanceInput below is what I'm passing as a parameter of this mutation

@GraphQLField
public MutationResult updateSpaceInstance(
	  @GraphQLName("spaceInstanceInput") final SpaceInstanceInput spaceInstanceInput) {

where SpaceInstanceInput data structure looks like:

public class SpaceInstanceInput {

    private final List<LogSubscriptionInput> logSubscriptions = null;
    private LogSubscriptionInput firstLogSubscriptions;

    // WORKS FINE
    @GraphQLField
    public LogSubscriptionInput getFirstLogSubscription() {
        return this.firstLogSubscriptions;
    }

    // DOES NOT WORK
    @GraphQLField
    public List<LogSubscriptionInput> getLogSubscriptions() {
        return this.logSubscriptions;
    }

}

public class LogSubscriptionInput {

    private LogTypeInput logTypeInput;
    private String subscriptionId;

    @GraphQLField
    public LogTypeInput getLogTypeInput() {
        return this.logTypeInput;
    }

    @GraphQLField
    public String getSubscriptionId() {
        return this.subscriptionId;
    }
}

public class LogTypeInput {

    private final String format;
    private final String type;

    @GraphQLField
    public String getFormat() {
        return this.format;
    }

    @GraphQLField
    public String getType() {
        return this.type;
    }
}
@joel-costigliola
Copy link
Author

joel-costigliola commented Apr 19, 2017

I have found that there is similar problem when using @GraphQLNonNull to wrap a complex input type like LogTypeInput.

@joel-costigliola
Copy link
Author

I think the problem might come from geInputObject that should check whether it deals with an GraphQLList or GraphQLNonNull and look inside it (recursively) for object input types.

@mpires
Copy link

mpires commented May 5, 2017

Thank you for that, I stumbled upon the same issue and that was helpful.

@apottere
Copy link
Contributor

apottere commented May 5, 2017

If someone wants to cook up a PR for this I can merge it, but I don't have time to look into it myself ⏳

@joel-costigliola
Copy link
Author

@apottere I'm busy but I will try to find the time to fix this issue.

@mpires
Copy link

mpires commented May 8, 2017

Hey guys I went ahead and fixed this, the pull request is #80
@apottere would you be able to merge it? Additionally, do you have any plans for the next release?

@mpires
Copy link

mpires commented May 8, 2017

Hang on, I noticed that while it fixes the GraphQLNonNull situation, it can be extended to do the same for the issue @joel-costigliola raised. I'm adding that to the PR

@apottere
Copy link
Contributor

apottere commented May 8, 2017

I haven't released this library yet, but I can probably set it up today. Might take a day or two to get it synced.

mpires pushed a commit to mpires/graphql-java-annotations that referenced this issue May 8, 2017
…hQLModifiedType would fail to resolve the input fields
@mpires
Copy link

mpires commented May 8, 2017

Meanwhile I think this change in the PR fixes the issue raised by @joel-costigliola

@tdraier
Copy link
Collaborator

tdraier commented Jul 7, 2017

This issue is also more globally fixed in #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants