palantir / palantir/conjure-java-runtime-api
Non-string error arg values are serialized to JSON strings instead of JSON objects
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 6
- Forks
- 33
- Avg merge
- 15h 50m
- Merged PRs (30d)
- 12
Description
What happened?
Serializing a ServiceException with a non-string object as the value of an Arg serializes the value of the arg as a JSON string instead of a proper JSON object (seems to happen in SerializableError.forException where the toString representation of the object is used, as opposed to the proper JSON object) - for example SafeArg.of("param", ImmutableList.of("arg1", "arg2"))
This is a problem since it's a mismatch between what the consumer of the exception expects (JSON object) and the actual JSON value (JSON string containing the toString representation of the object)
What did you want to happen?
Convert the safe-arg value to a proper JSON object, since that is what the consumer code expects.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in errors/src/main/java/com/palantir/conjure/java/api/errors/SerializableError.java at SerializableError.forException, using SafeArg.of("param", ImmutableList.of("arg1", "arg2")) as the reproduction. Trace how the non-string value is serialized and verify that the resulting error JSON contains an object rather than a string containing its toString representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100