-
Notifications
You must be signed in to change notification settings - Fork 93
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 Mutation exceptions when no setters are present. #1387
Comments
To be able to do a mutation you are going to need setters. Why do you not have setters ? |
Because, I am building a GraphQL wrapper on an existing service that doesn't have setters. The REST wrapper on that works without any issues, so I wondered why GraphQL doesn't work. |
Is there any particular reason why GraphQL mutation need setters? IMHO the parameterized constructors should be enough to create the object using the Jackson deserialization. Thanks. |
If I remember correctly, the quarkus version still uses jsonb. If you don't have setters, you need to do something like this for the server input objects |
@robp94 Yeah this one works after I update my constructor with |
Want to check, can we have Jackson support for Quarkus GraphQL? |
What do you mean by Jackson support? |
To put it simply, expecting GraphQL mutations to work with |
Should be possible. Let's leave this open and we can look at it at some point. Or you can do a PR if you are keen. |
I think this should work with smallrye-graphql/common/schema-builder/src/main/java/io/smallrye/graphql/schema/Annotations.java Line 615 in a7216b5
|
Not sure if you meant to do it differently (posted reproducer does uses |
Yes initially I thought we don't support it, but we do, as the annotations are there, so this is a bug |
Hello,
With Quarkus GraphQL, I am facing couple of exceptions with mutations when setters are not present in the model class. I made a small reproducer for this, which is available at https://github.com/zbhavyai/quarkus-graphql-nosetters-reproducer.
To explain, the
Film
class has no setters. The REST endpoints to add aFilm
works fine. The GraphQL mutations however throw exception -Cannot create instance of a class. No default constructor found.
When I add a default constructor,InvalidSchemaException
is thrown at build time.The exceptions faced might be somewhat related to #1342, but I am not sure if the actual issue is related at all.
So, my question is - why exactly are setters required? If REST works fine without them, shouldn't GraphQL too? Is it bug or GraphQL limitation?
Thanks in advance.
The text was updated successfully, but these errors were encountered: