'How to suppress field from GraphQLClientRequest request body?
When I use ExpediaGroup graphql-kotlin client to call a GQL query, it inserts a field besides the query
, variables
and operationName
. I understand this field comes from my extended class constructor parameter. I don't need this field. Is there a way to suppress it?
My class:
class SubmissionQuery(val submissionUuid: String): GraphQLClientRequest<SubmissionQuery.Result> { ... }
Request body:
{
"submissionUuid":"0c00a000-3f03-4f57-b999-7082e2a53fa1",
"operationName":"",
"query":"query($uuid: String!) {myQuery(uuid: $uuid){uuid}}",
"variables":{"uuid":"0c00a000-3f03-4f57-b999-7082e2a53fa1"}
}
Solution 1:[1]
Got it in the last minute: just change the parameter to private in constructor.
class SubmissionQuery(private val submissionUuid: String)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | heringer |