Skip to content

fix: write schema JSON and document hashes with the invariant culture (#3186) - #3188

Merged
Vincent Biret (baywet) merged 1 commit into
support/v2from
fix/culture-stream-to-v2
Nov 23, 2026
Merged

Vincent Biret (baywet) merged 1 commit into
support/v2from
fix/culture-stream-to-v2

Conversation

@baywet

Copy link
Copy Markdown
Member

port of #3186

…#3186)

OpenApiSchemaJsonConverter.Write wrote the schema through a StreamWriter,
whose format provider is the current culture, and passed the result to
Utf8JsonWriter.WriteRawValue without validation. Under de-DE a default of
1.5 came out as "1,5" and under fi-FI -5 as "−5" (U+2212), both invalid
JSON. OpenApiDocument.GetHashCodeAsync had the same writer, so a
document's hash depended on the machine's culture.

Both now use FormattingStreamWriter with CultureInfo.InvariantCulture,
like the SerializeAsync extensions already do.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@baywet
Vincent Biret (baywet) requested a review from a team as a code owner November 23, 2026 14:14
@baywet
Vincent Biret (baywet) enabled auto-merge (squash) November 23, 2026 14:14
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

support/v2 cd7cb1c fix/culture-stream-t... 2f54a37 +/-
93% 24% -69%
View coverage of the 10 most impacted files.
File support/v2 cd7cb1c fix/culture-stream-t... 2f54a37 +/-
_/src/Verify/Se.../ScrubEngine.cs 0% 29% +29%
_/src/Verify/Ve...rifier_Inner.cs 0% 35% +35%
_/src/Verify/Na...fierSettings.cs 0% 45% +45%
_/src/Verify/Ve...nnerVerifier.cs 0% 46% +46%
_/src/Verify/At...fierSettings.cs 0% 55% +55%
_/src/Verify/Se...fierSettings.cs 0% 64% +64%
_/src/Verify/Se...tionSettings.cs 0% 65% +65%
_/src/Verify/Fi...eNameCleaner.cs 0% 85% +85%
_/src/Verify/Se...eScrubberSet.cs 0% 85% +85%
_/src/EmptyFile...leExtensions.cs 0% 86% +86%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@baywet
Vincent Biret (baywet) merged commit fe24d15 into support/v2 Nov 23, 2026
16 of 17 checks passed
@baywet
Vincent Biret (baywet) deleted the fix/culture-stream-to-v2 branch November 23, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants