open-api
open-api copied to clipboard
Using `x-express-openapi-disable-validation-middleware` extension
In your docs and sample project a x-express-openapi-disable-validation-middleware
can be added at a top-level api-doc.
However! Configuring top-level api-doc like so in TypeScript results in an error:
Object literal may only specify known properties, and ''x-express-openapi-disable-validation-middleware'' does not exist in type 'Document<{}>'.ts(2353)
(property) 'x-express-openapi-disable-validation-middleware': boolean
Code to reproduce - just use schema with the mentioned vendor extension:
import { OpenAPIV3 } from 'openapi-types'
export const schema: OpenAPIV3.Document = {
openapi: '3.1.0',
info: {
title: 'My API',
version: '1.0.0',
description:
'whatever service'
},
paths: {},
'x-express-openapi-disable-validation-middleware': true
}
The initialize
function accepts OpenAPIV3.Document
, but this in turn has some props described here missing:
https://github.com/kogosoftwarellc/open-api/blob/main/packages/openapi-types/index.ts#L271