Swashbuckle.AspNetCore
Swashbuckle.AspNetCore copied to clipboard
Server information in openapi.yaml is not in alignment with JSONSchema
Use SwaggerWebHostFactory
to create the custom WebHost.
Run dotnet swagger cli tool to generate the openapi.yaml. The openapi linter fails because region is missing the key default
.
The error comes from JSON Schema
Refer : https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.0/schema.json#L167
Output:
servers:
- url: 'https://try{stage}.test{region}.{tld}{basePath}'
variables:
stage:
default: '-sandbox'
region: { }
tld:
default: net
basePath: { }
Expected:
servers:
- url: 'https://try{stage}.test{region}.{tld}{basePath}'
variables:
stage:
default: '-sandbox'
region:
default: ''
tld:
default: net
basePath:
default: ''