tapir icon indicating copy to clipboard operation
tapir copied to clipboard

Respond in valid JSON Array when using streams

Open grzegorz-bielski opened this issue 1 year ago • 1 comments

Hello!

In http4s there is streamJsonArrayEncoderOf which allows you to use fs2.Stream but encode it as a valid JSON Array.

When in one of our services we switched to Tapir for endpoints definitions, we noticed that this functionality is missing, or at the very least we are not sure how to achieve it.

For us, this is very useful, as for short streams, it allows for easier integration with different tools that might not understand NDJSON or other approaches.

As a workaround we roll out our own stream json array encoding, but It'd be nice to have this built-in in Tapir, maybe as an opt-in.

grzegorz-bielski avatar Oct 24 '24 07:10 grzegorz-bielski