-
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
Type-safe client custom serialiser for input variable #2257
Comments
Right, we don't use json-b for serializing input objects, the typesafe client implements that manually. |
With This is always sending null when the value is not set. But I need to be in control and be able to (at JSON level):
If I really display the Remove a parent relation: {
"arg0": {
"id": "gid://gitlab/WorkItem/123",
"hierarchyWidget": {
"parentId": null
}
}
} Add a child relation: {
"input": {
"id": "gid://gitlab/WorkItem/123",
"hierarchyWidget": {
"childrenIds": [
"gid://gitlab/WorkItem/789"
]
}
}
} --> note that Set a parent relation: {
"arg0": {
"id": "gid://gitlab/WorkItem/123",
"hierarchyWidget": {
"parentId": "gid://gitlab/WorkItem/456"
}
}
} Problematic call: {
"arg0":{
"id": "gid://gitlab/WorkItem/123",
"hierarchyWidget": {
"parentId": null,
"childrenIds": [
"gid://gitlab/WorkItem/789"
]
}
}
} --> error: Which is what I currently get the java client with |
My solution unblu/gitlab-workitem-graphql-client@6c578ba with |
With unblu/gitlab-workitem-graphql-client@96673d8 I am now trying a different approach: Have
At the end since the server do not support setting both I now need to verify if it works with the smallrye-graphql typesafe client, when running the different queries. |
I have updated my Having the |
I am using the gitlab graphql api and I am running this mutation request:
The java client I am using is here:
https://github.com/unblu/gitlab-workitem-graphql-client/
In particular see the
WorkItemUpdateInput
class definition which has a memberhierarchyWidget
of typeWorkItemWidgetHierarchyUpdateInput
The documentation is not really clear about the
hierarchyWidget
:https://docs.gitlab.com/ee/api/graphql/reference/#workitemwidgethierarchyupdateinput
Those are the key point (for the client):
parentId
you have 3 values:null
to remove the parent associationparentId
andchildrenIds
in the same request"One and only one of children, parent or remove_child is required", so in theory we should do multiple runs, especially in case of "turning a child into a parent or the other way around".
So again this is a case where not setting the value and setting it explicitly to
null
has a different meaning.json-schema-org/json-schema-spec#584 (comment)
And in Java this is always tricky.
I stared an implementation with a
NullableProperty<T>
helper class (to support the 3 states) annotated with@JsonbTypeSerializer
and@JsonbTypeDeserializer
Yasson test (jbang)
It works great at Json-b level, but I have the feeling that the typesafe client is doing something else when it comes to the serialization of the Input object.
The text was updated successfully, but these errors were encountered: