Hi, I am using graphql-kotlin client. I am having ...
# graphql-kotlin
d
Hi, I am using graphql-kotlin client. I am having issue with parsing this graphql response which sadly has non standart UpperCases of attributes:
Copy code
{
  "Data": {
    "CreateIssuedInvoice": {
      "ID": "62d0e9c6-1c54-4324-8ac5-716701b325be",
      "Stav": 0,
      "CisloDokladu": "240010989"
    }
  },
  "Status": 1,
  "Message": "",
  "StackTrace": ""
}
but default deserialisation of
GraphQLWebClient
is unable to parse it. I assume that’s is because of first uppercase letter? Is here any possible workaround how to fix that?
adding
@get:JsonProperty
on all response fields helped. like:
@get:JsonProperty("CreateIssuedInvoice")
Do you think that it will be possible to add that also for generated responses? As you did it here for requests.
in my case I also had to add
Copy code
.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
for Jackson object mapper to pass
Data
attribute with first uppercase.
d
👋 so the
Data
response is invalid per GraphQL spec and it should be
data
but I think annotating the response fields should be fine
PRs are always welcome
d
alright, thanks. I will prepare PR.
Hi, I kicked up first draft: https://github.com/ExpediaGroup/graphql-kotlin/pull/1976 Can you check if change is ok? 🙏
d
👋 I was just thinking about it and wondering why do you actually need to annotate the response?
are you serializing it AGAIN after fetching it through a client?
*as otherwise it "should" be working fine
**I think
d
Hi, sry I was off this weekend. I am just using deseralization of response in GraphQLWebClient. But Without @JsonProperty annotation it does not work. Names of properties in my response are really non-standart. Like
Firstuppercase
,
ALLUPPERCASE
or
FirstUpAndThenCamelCase
👍 1
But I assume there is no big disadvantage to have the annotation above every field?
d
guess it should be fine
i'll get to the review tomorrow
🙏 1