-
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
Typed client: force sending null value #2251
Comments
I somehow need to set something like: JsonbConfig config = new JsonbConfig()
.withNullValues(true) |
Yeah could you try to register a custom
Also see the documentation: https://smallrye.io/smallrye-graphql/2.11.0/custom-json-serializers-deserializers/ And let me know if this works (I hope it will) |
I was exactly looking at those, but they are server-side features. |
Ah, sorry! I guess my brain was turned off. I think we don't have explicit control over this on the client, but I vaguely remember we had a debate that when you use a |
I have change the class WorkItemWidgetRolledupDatesInput to a record: package graphql.gitlab.model;
import org.eclipse.microprofile.graphql.Name;
@Name("WorkItemWidgetRolledupDatesInput")
public record WorkItemWidgetRolledupDatesInput(Date startDateFixed, Boolean startDateIsFixed, Date dueDateFixed, Boolean dueDateIsFixed) {
} And the query to: WorkItemUpdateInput request = new WorkItemUpdateInput()
.setId(workItem.getId())
.setRolledupDatesWidget(
new WorkItemWidgetRolledupDatesInput(null, true, null, true) //
);
WorkItemUpdatePayload updateResponse = api.workItemUpdate(request); And it does not seems to have any impact (which I think makes sense). Side not on the usage of records: The mutation query we formulate now with classes (using a builder pattern and chain-able setters) is quite convenient.
So I don't think I would like to use records for my graphQL queries. |
I think I found it: Lines 448 to 455 in c790847
And: Lines 29 to 33 in c790847
So the solution is: public class WorkItemWidgetRolledupDatesInput {
/**
* Fixed start date for the work item.
*/
@JsonbProperty(value = "startDateFixed", nillable = true)
private Date startDateFixed;
/**
* When start_date_fixed is not provided it defaults to `false`.
*/
private Boolean startDateIsFixed;
/**
* Fixed due date for the work item.
*/
@JsonbProperty(value = "dueDateFixed", nillable = true)
private Date dueDateFixed;
/**
* When due_date_fixed is not provided it defaults to `false`.
*/
private Boolean dueDateIsFixed;
// ... |
@jmartisk thank you very much for your help |
Ah, good catch, I'd forgotten about that! Ok, glad that it's resolved. |
I just saw that the So I guess a follow up issue/PR to fix |
Feel free to send a PR :) |
See #2253 for support of |
It seem that the gitlab graphql server has a very specific way of treating null.
I looked at the query created by the js graphQL client when an action (removing the due-date of a workItem) is created in the UI. It's send:
I was able to reproduce it in graphiQL https://gitlab.com/-/graphql-explorer
Corresponding java code:
Library is here: https://github.com/unblu/gitlab-workitem-graphql-client
But this is turned by the typed-client to this request:
The
null
values are not sent, and it seem that this is interpreted differently by the server.If change graphiQL to:
As with the java typed client, no change is performed by the server.
Is it a way to force the GraphQL client to set the
null
values?The text was updated successfully, but these errors were encountered: