Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"openapi" field in generated yaml depends on OS culture settings #2602

Closed
AffeCode opened this issue Feb 3, 2023 · 3 comments · Fixed by #2795
Closed

"openapi" field in generated yaml depends on OS culture settings #2602

AffeCode opened this issue Feb 3, 2023 · 3 comments · Fixed by #2795

Comments

@AffeCode
Copy link

AffeCode commented Feb 3, 2023

When I generate OpenAPI yaml spec with Swashbuckle.AspNetCore.Cli the "openapi" field in the generated spec containing the OpenAPI version gets generated differently depending on the culture settings in the OS.

Repro steps:

  1. On windows 11 go to "Time & language" > "Language & region" under settings and set "Regional format" to "English (United States)".
  2. Generate an OpenAPI spec as yaml with Swashbuckle.AspNetCore.Cli
  3. The generated file will look like:
openapi: 3.0.1
...
  1. Go to "Time & language" > "Language & region" under settings and set "Regional format" to "English (Denmark)".
  2. Generate an OpenAPI spec as yaml with Swashbuckle.AspNetCore.Cli
  3. The generated file will look like:
openapi: '3.0.1'
...

This is most likely related to the fact that some cultures use "." as decimal separator while other cultures use ",".

It would be great if the generated spec would be identical regardless of the users culture settings 🙂

@AffeCode
Copy link
Author

AffeCode commented Feb 7, 2023

It seems like this has been fixed in microsoft/OpenAPI.NET@a389eb6

Swashbuckle.AspNetCore.Swagger.csproj is using version "1.2.3" of "Microsoft.OpenApi", and the above fix was released in version "1.4.4" (latest is "1.6.0").

@Havunen
Copy link

Havunen commented Feb 22, 2024

FYI this is fixed in DotSwashbuckle

@martincostello
Copy link
Collaborator

Tracked by #2606.

@martincostello martincostello closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants