domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.2k stars 1.29k forks source link

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

Closed sbansal-mdsol closed 1 month ago

sbansal-mdsol commented 3 years ago

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: ''
martincostello commented 3 months ago

Please provide a minimal reproducible example as a GitHub repository that demonstrates the issue you're experiencing so we can look into this further.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.