Wrong Marshalling when Entity is `Optional`
- Dominant language
- Scala
- Stars
- 1.4k
- Forks
- 584
- Avg merge
- 14h 33m
- Merged PRs (30d)
- 24
Description
When completing a route with a Java `Optional` the output is not the one I would expect:
## Expected Behavior
* If `Optional[T]` is empty: completed with an empty `Entity`
* If `Optional[T]` is not empty: completed with proper marshalling of `T`
## Actual Behavior
* If `Optional[T]` is empty: completed with `{"present": false}`
* If `Optional[T]` is not empty: completed with `{"present": true}`
I have a gist where one can reproduce this: https://gist.github.com/jlprat/5e1c27ce4b912e0a3eb0ad56237246d7
Contributor guide
Research direction
Start with the linked reproduction gist and trace how Java Optional values are marshalled when completing an Akka HTTP route. Compare empty and present values with the expected Entity output; done means both cases produce the specified entity behavior and the regression is covered by a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100