-
Is there a way to describe a json-lines with OpenAPI? Besides the fact that there seems to be no mimetype for it yet, I'm wondering if it's possible to describe such a response. In theory my response could be an array of objects, but I received the question whether or not I could deliver as json-lines, meaning: Just the objects, one per line. Since I'm using OpenAPI to describe my API I'm puzzled as how to describe this response. I could simply define the response as being of type "string", but this is not very helpful for readers of my Api-spec. P.S. I already asked at stackoverflow and was pointed to here. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Not automatically. There would need to be a mapping defined to the JSON lines media type, and tools would need to support it. There's no reason you can't just treat it as an array of objects and just document that it's a series of lines rather than a JSON array, but that would only work for human-readable documentation. It's not clear to me what advantage JSON Lines has over RFC 7464 JSON Text Sequences. |
Beta Was this translation helpful? Give feedback.
-
I've filed issue #3730 to add support for both formats (they're equivalent in terms of data modeling) to the next minor release. I'm going to close this discussion in favor of the issue. |
Beta Was this translation helpful? Give feedback.
Not automatically. There would need to be a mapping defined to the JSON lines media type, and tools would need to support it. There's no reason you can't just treat it as an array of objects and just document that it's a series of lines rather than a JSON array, but that would only work for human-readable documentation.
It's not clear to me what advantage JSON Lines has over RFC 7464 JSON Text Sequences.