Closed gregor-rayman closed 1 month ago
/bounty $125 to make .outStream[X]
return a JSON array, and a test case to prove it.
/attempt #3113
with your implementation plan/claim #3113
in the PR body to claim the bountyThank you for contributing to zio/zio-http!
Add a bounty • Share on socials
Attempt | Started (GMT+0) | Solution |
---|---|---|
🟢 @gregor-rayman | Sep 10, 2024, 11:46:36 AM | #3122 |
/attempt #3113
Implement an encoder with the data interspersed with [
, ,
, ]
For the decoder parse the array incrementally, not as a single JSON array
💡 @gregor-rayman submitted a pull request that claims the bounty. You can visit your bounty board to reward.
@gregor-rayman: You've been awarded a $125 bounty by ZIO! 👉 Complete your Algora onboarding to collect the bounty.
🎉🎈 @gregor-rayman has been awarded $125! 🎈🎊
Is your feature request related to a problem? Please describe. Conceptually when an endpoint returns a list of X, it is the same as when it returns a ZStream[, , X]. Currently the default output encoding for
.out[X]
is an JSON array. For.outStream[X]
it is however a not separated collection of JSONs. TheContent-Type
in the response isapplication/json
, correct one would beapplication/json-seq
.Describe the solution you'd like Either the data should be returned as a JSON array, so prefixed with
[
, separated by,
and terminated by]
, or theContent-Type
should beapplication/json-seq
. I'd prefer the array, because that makes the change change from.out[List[X]]
to.outStream[X]
an internal change of the server, without the need to change the clients.Describe alternatives you've considered A viable solution currently (RC10) is to provide custom codes for endpoints with
.outStream[X]
stream outputs.