swagger
swagger copied to clipboard
Support setting the openapi version in DocumentBuilder
Is there an existing issue that is already proposing this?
- [X] I have searched the existing issues
Is your feature request related to a problem? Please describe it
When generating OAS docs for my service, the swagger-ui editor returns errors for some of the nested objects.
The error: allOf must be a non-empty array of schemas
.
If I change the openapi version to 3.1.0, the errors disappear.
Describe the solution you'd like
I'd like to be able to set the openapi version through a DocumentBuilder set
function
const config = new DocumentBuilder()
.setOpenAPIVersion('3.1.0')
.setTitle('Cats example')
.setDescription('The cats API description')
.setVersion('1.0')
.addTag('cats')
.build();
Or maybe a better option would be to produce the correct version of OAS automatically
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
I'd like to be able to generate OAS documentation that does not contain errors in the Swagger editor.
Why has this not been merged yet? https://github.com/nestjs/swagger/pull/2516
Would you like to create a PR for this?
did this ever make it into the codebase ?
@doblinger-extron @jmls I do the following to update open API version
SwaggerModule.setup(
'api',
app,
{ ...document, openapi: '3.1.0' })