-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Set culture of Json Serializer to InvariantCulture #2105
Comments
For people searching for a temporary work around, set environment variable i.e. in csproj:
|
Nice, @domaindrivendev does the PR by @dinar007007 look like something you accept? The workaround purposed by @desjoerd does not work for me, it disables all access to other cultures
|
@desjoerd can you confirm you are not doing anything culture specific in your project? |
Proposed fix in #2726 |
Not in our apis or in the codepath the generator uses, so thats probably why it works for us. |
Version 6.1.1
I noticed a bug where the examples in our swagger.json files that were generated did not include correctly formatted values for the data type "double". Instead of being formatted as "123.123" it was being formatted as "123,123". The issue was that our application is using the sv-SE culture
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("sv-SE");
.I imagine a lot of applications want to specify their own culture, but shouldn't the generated swagger.json always be using InvariantCulture so we won't have to face these issues?
I know this is an easy fix for Newtonsoft.Json, but since Swashbuckle is using System.Text.Json, I'm not sure what the best way to solve this is, otherwise I would have submitted a PR.
The text was updated successfully, but these errors were encountered: