Skip to content
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

GraphQL schema is not generated when mutation input has Long generic type #1963

Closed
vtcosta opened this issue Nov 13, 2023 · 0 comments · Fixed by #1966
Closed

GraphQL schema is not generated when mutation input has Long generic type #1963

vtcosta opened this issue Nov 13, 2023 · 0 comments · Fixed by #1966
Assignees

Comments

@vtcosta
Copy link

vtcosta commented Nov 13, 2023

I've been trying to run a similar solution as the one described in the issue 1928, but including mutations. Here is a similar example as the other issue, including a mutation, with a parameterized type of String:

public interface Attribute<T> {
    T getValue();
    void setValue(T value);
}

public class Greet implements Attribute<String> {
    private String value;

    public Greet() {}

    public Greet(String value) {
        this.value = value;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public void setValue(String value) {
        this.value = value;
    }
}

    @Query
    public Greet sayHello(String value) {
        return new Greet(value);
    }

    @Mutation
    public boolean updateGreet(Greet greet) {
        return true;
    }

The example above seems to be working just fine. But if I change the parameterized type to Long, it will throw the exception graphql.AssertException: type Object not found in schema

Here is the example:

public class Greet implements Attribute<Long> {
    private Long value;

    public Greet() {}

    public Greet(Long value) {
        this.value = value;
    }

    @Override
    public Long getValue() {
        return this.value;
    }

    @Override
    public void setValue(Long value) {
        this.value = value;
    }
}

    @Query
    public Greet sayHello(Long value) {
        return new Greet(value);
    }

    @Mutation
    public boolean updateGreet(Greet greet) {
        return true;
    }

It seems this Long problem is specific for the mutation, because if I leave just the query, it works.

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