Correct rendering of response with Mime Type application/x-ndjson (NDJSON)
Hi Folks,
I'm not sure if this is the correct form for my question, but hopefully it is.
I am using Swagger/UI to render the OpenAPI definitions of a suite of REST endpoints, some of which return JSON (application/json) and some of which return NDJSON (application/x-ndjson).
We specifically use newline-delimited JSON (NDJSON) for streaming responses, where the first content is available from the service before, sometimes long before, the complete content is available. We do this with Spring WebFlux and Reactor, in order to reduce latency times to the caller and to reduce heap requirements in caller and server.
When viewed in Swagger/UI an application/json response is prettily rendered.
When viewed in Swagger/UI an application/x-ndjson is not prettily rendered, and is even prefixed by the message
can't parse JSON. Raw result:
My hope to see this resolved, such that application/x-ndjson is a recognised format and each line of JSON is appropriately rendered.
My user-base believes "appropriately rendered" should mean each single line received is rendered as an indented multi-line output easily human-readable. Others on this list may have their own views regarding what "appropriately rendered" should mean in the context of an application/x-ndjson response.
If this is not a known issue with a fix in-hand then I will happily clone the projet and put together a PR. I'd need to know what project to clone, and it would be helpful to know which class outputs that "Raw result:" message, although IntelliJ would find it pretty quickly.
Let's discuss!
Thanks, Robin.