question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enums in arguments are serialized in quotes

See original GitHub issue

When there is an enum in query inlined arguments it is serialized as a string in quotes. See the following example - the alignment input field is an enum field.

Current request:

mutation {
        someMutation(
                update: {alignment: "left"}
        ) {
                ok
                errorMessage
        }
}

Expected request:

mutation {
        someMutation(
                update: {alignment: left}
        ) {
                ok
                errorMessage
        }
}

I can work around it by sending the arguments in variables, but that’s not ideal for my use case.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
babyfish-ctcommented, May 13, 2022

Different from the parameters of variables-style, inline-style parameters are not developed based on the type system (This problem was thought about when the project is created, and the reason why it was not dealt with is because inline-style is not the main design goal).

To fix this flaw, a major refactoring would have to be done to make inline-style parameters based on type information instead of plain JSON, so that the system can distinguish between strings and enums.

So, it’s a huge task and can’t be achieved in the short term.

The variables-style is better than the inline-style, and almost all frameworks recommend the variable-style.

However, your answer surprised me, what particular scenario leads you to think inline-style is better? Could you share your scenario and your thoughts?. maybe there is a better way.

0reactions
babyfish-ctcommented, Jun 22, 2022

Because 3.1.3 or 3.1.4 fixed it.

Later, 3.1.5 will be released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to ensure consistency of enums in Java serialization?
The serialized form of an enum constant consists solely of its name; field values of the constant are not present in the form....
Read more >
(De)serialization of enums could use a simpler format #251
My workaround so far has been a two step deserialization. First, serde is used to deserialize the data into a StructRaw where the...
Read more >
How To Serialize and Deserialize Enums with Jackson
In this quick tutorial, we'll learn how to control the way Java Enums are serialized and deserialized with Jackson 2.
Read more >
[CLOSED] The best approach to serialize an enum as its value
Hi everybody, By default, JSON.NET serializes an enum with its value. There is a special StringEnumConverter to get it converted with its name ......
Read more >
Enums - Swagger
Enums. You can use the enum keyword to specify possible values of a request parameter or a model property. For example, the sort...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found