A JSON Schema carrying the TypeScript type of the request bodies it accepts.
Routes of the external API declaring a RestBodySchema get their request body validated
against the schema and the schema published in the OpenAPI document, while the carried
type flows into the route's handler and custom validation. The declaration of a schema
constant is the single place asserting that schema and type agree. The type is not
verified against the schema:
exportconstSCHEMA: RestBodySchema<MyRequest> = { type:'object', required: ['text'], additionalProperties:false, properties: { text: { type:'string', description:'The text to process.' } } };
A JSON Schema carrying the TypeScript type of the request bodies it accepts.
Routes of the external API declaring a
RestBodySchemaget their request body validated against the schema and the schema published in the OpenAPI document, while the carried type flows into the route's handler and custom validation. The declaration of a schema constant is the single place asserting that schema and type agree. The type is not verified against the schema: