feat!: response headers, type-safe styles, multi-content-type#6
Merged
maxholman merged 1 commit intoblock65:masterfrom Apr 9, 2026
Merged
Conversation
…i-content-type responses Implement the Header construct for OpenAPI 3.1 response headers with components/headers registration and $ref support. Enforce lowercase header names at the type level for HTTP/2 compliance (RFC 7540 §8.1.2). Constrain parameter style values per location (path/query/header/cookie) matching the OAS 3.1 style table, and add the missing explode field. Widen MediaType contentType to accept any MIME string while preserving autocomplete for common types. Allow Response and RequestBody to accept arrays of content types for endpoints serving multiple representations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HeaderObjectimplementation withsynth(),referenceObject(),components/headersregistration, and export from package indexHeaderIDs,Parameter<_, 'header'>names,Response.headerskeys, andValidParameterall reject uppercase at compile time viaLowercase<string>constraintsStyleForIn<TIn>constrainsstylevalues per OAS 3.1 location (e.g. query getsform | spaceDelimited | pipeDelimited | deepObject, header getssimple). Added missingexplodefieldResponseandRequestBodyacceptcontentas single value or array, enabling endpoints with multiple representations (e.g. JSON + binary)MediaType.contentTypeaccepts any string while preserving autocomplete for common types (application/json,application/octet-stream,text/plain, etc.)Breaking changes
Response.headerstype changed fromHeader[]toRecord<Lowercase<string>, Header>Parameterstylefield now constrained perinlocation (previously only accepted'simple')ValidParameterheader variant now requiresLowercase<string>namesTest plan
tsc --noEmitpasses@apidevtools/swagger-parser@ts-expect-errornegative)