feat: support OpenAPI 3.2 itemSchema (SSE/streaming)#2683
feat: support OpenAPI 3.2 itemSchema (SSE/streaming)#2683dkachur1 wants to merge 1 commit intoopenapi-ts:mainfrom
Conversation
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: 8c6c20f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Relevant section in the OpenAPI spec: https://spec.openapis.org/oas/v3.2.0.html#complete-vs-streaming-content @drwpow I'd like your input on this one: It seems that @dkachur1 congrats on your first OSS contribution! For the first review iteration, I have some higher level comments for you:
Hope that helps. LMK if you have questions> |
gzm0
left a comment
There was a problem hiding this comment.
Requesting changes as per last comment.
d745f04 to
8c6c20f
Compare
|
@gzm0 Thanks for the feedback! I've reverted the Redocly 2.0 migration and kept the changes minimal. Updated the description to address the points you raised. Most of the diff is in tests, let me know if any should be cut. Happy to revisit |
Summary
Adds support for the
itemSchemafield introduced in OpenAPI 3.2, which defines the shape of individualitems in streaming responses (e.g.
text/event-stream,application/x-ndjson).MediaTypeObjecttype now includesitemSchemaitemSchemais present, it takes precedence overschemafor type generationDesign note:
itemSchemavsschemacoexistenceThe spec allows both
schema(complete payload) anditemSchema(per-item) on the same media type object. For type generation, we preferitemSchemawhen present because itdescribes what consumers actually parse per event/chunk. This is a deliberate trade-off — see spec reference
for details.
Example