leangen / graphql-spqr

Build a GraphQL service in seconds
Apache License 2.0
1.1k stars 181 forks source link

InputField values from Immutables not working properly #340

Open arssycro opened 4 years ago

arssycro commented 4 years ago

Based off #293, I have created the following example classes:

public class ValueHandler {
    @GraphQLMutation(name = "addValue", description = "Adds a value.")
    public boolean addValue(@GraphQLArgument(name = "value") Value value) {
        return false;
    }
}

and

@Immutable
@JsonSerialize(as = ImmutableValue.class)
@JsonDeserialize(as = ImmutableValue.class)
public interface Value {
    @GraphQLNonNull
    @GraphQLInputField(name = "valueType", description = "The type of value.")
    String getValueType();

    @GraphQLNonNull
    @GraphQLInputField(name = "value", description = "The value.")
    String getValue();
}

If I start up my server, I see by ValueInput object, but there is no description included for its objects. Debugging through, it appears to never even ask for the descriptions when using Immutables.

image

To make things more interesting, if I change the name in the GraphQLInputField, say to "value_type", I end up with nothing for it.

@Immutable
@JsonSerialize(as = ImmutableValue.class)
@JsonDeserialize(as = ImmutableValue.class)
public interface Value {
    @GraphQLNonNull
    @GraphQLInputField(name = "value_type", description = "The type of value.")
    String getValueType();

    @GraphQLNonNull
    @GraphQLInputField(name = "value", description = "The value.")
    String getValue();
}

results in

image

baohouse commented 2 years ago

@arssycro Have you tried putting the @GraphQLInputField annotation on the setters?