Releases: responsibleapi/responsible
Release list
@responsibleapi/ts v1.2.0
Explicit object strictness
OpenAPI permits extra object properties by default when additionalProperties is omitted. Some downstream validators follow that behavior. In particular, Go services using kin-openapi may accept unknown fields where a strict API would reject them. Other validators and generators may behave the same way.
@responsibleapi/ts now provides one document-wide switch for explicit object strictness:
responsibleAPI({
options: {
objectAdditionalProperties: false,
},
partialDoc: { /* ... */ },
routes: { /* ... */ },
})falseemitsadditionalProperties: falsefor every schema created withobject(), including nested objects and objects used in requests, responses, components, arrays, unions, and nullable schemas.trueexplicitly keeps everyobject()schema open.- Omitting
optionspreserves existing output exactly.
This makes generated OpenAPI documents reliably strict across downstream tooling without changing every object schema individually. dict() remains a typed dictionary and is not closed by this switch.
@responsibleapi/ts v1.1.0
Typed Server-Sent Events
OpenAPI 3.2 can describe each event in a text/event-stream response with itemSchema. @responsibleapi/ts now generates that output directly:
200: resp({
body: {
"text/event-stream": {
itemSchema: object({
event: string({ const: "message" }),
data: string(),
}),
},
},
})The generated OpenAPI document places the event schema at content["text/event-stream"].itemSchema. Downstream documentation, validators, and generators can understand each streamed event instead of treating the response as an untyped stream.
Any ResponsibleAPI schema can be used as the item schema, including named schemas and unions. This output requires an OpenAPI 3.2 document.