Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Server information in openapi.yaml is not in alignment with JSONSchema

Open sbansal-mdsol opened this issue 3 years ago • 2 comments

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: ''

sbansal-mdsol avatar Jul 27 '21 21:07 sbansal-mdsol