Fix #910 and #906: validation message separator space and global-namespace source generation - #912
Merged
mwadams merged 3 commits intoAug 2, 2026
Conversation
…ion messages AppendQuotedInteger omitted the leading space that AppendSingleQuotedValue writes, so every integer-valued message family (minLength/maxLength, minItems/maxItems, minContains/maxContains, minProperties/maxProperties) emitted text like "Expected the item count to be greater than or equal to'3'". The scan also found JsonSchema_ExpectedLessThan reading "greater than" in both resource copies; exclusiveMaximum failures reported the opposite comparison direction. Exact-format tests now pin all 24 integer-valued message providers and the six number-comparison messages. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZZMVqcEwHxGUmVYGY8Rte
The source generator's syntactic pre-filter required the attributed struct's parent to be a namespace declaration, so a global-namespace target (parent CompilationUnitSyntax) was silently dropped with no diagnostic. Behind the filter, ContainingNamespace.ToDisplayString() yields the literal "<global namespace>" string, and the C# emission assumed a non-empty namespace in four places (namespace declarations and fully qualified name construction). The target namespace now maps to the empty string (matching the query-language source generators), the emission skips the namespace declaration and the leading dot when it is empty, and the default namespace for shared generated types prefers the first non-empty spec so a global-namespace target cannot capture it. GlobalNamespaceModel in the GeneratedModels project proves generation end to end through the real build; regenerating the example recipes and a benchmark C directory confirmed byte-identical output for all namespaced inputs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZZMVqcEwHxGUmVYGY8Rte
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EZZMVqcEwHxGUmVYGY8Rte
Contributor
Contributor
Code Coverage Summary Report - Linux (net10.0)Summary
CoverageCorvus.Json.CodeGeneration - 80.5%
Corvus.Json.CodeGeneration.CSharp - 81.8%
Corvus.Json.ExtendedTypes - 74.9%
Corvus.Json.JsonReference - 76.7%
Corvus.Text.Json - 94.5%
Corvus.Text.Json.AsyncApi - 64.4%
Corvus.Text.Json.AsyncApi.Amqp - 0.6%
Corvus.Text.Json.AsyncApi.AzureServiceBus - 0%
Corvus.Text.Json.AsyncApi.CodeGeneration - 93.2%
Corvus.Text.Json.AsyncApi.Kafka - 0.6%
Corvus.Text.Json.AsyncApi.Mqtt - 0.9%
Corvus.Text.Json.AsyncApi.Nats - 0.4%
Corvus.Text.Json.AsyncApi.Polly - 100%
Corvus.Text.Json.AsyncApi.Testing - 96.6%
Corvus.Text.Json.AsyncApi.WebSocket - 0%
Corvus.Text.Json.CodeGeneration - 93.2%
Corvus.Text.Json.JMESPath - 93.8%
Corvus.Text.Json.JMESPath.CodeGeneration - 97.7%
Corvus.Text.Json.Jsonata - 91.6%
Corvus.Text.Json.Jsonata.CodeGeneration - 88.5%
Corvus.Text.Json.JsonLogic - 95.1%
Corvus.Text.Json.JsonLogic.CodeGeneration - 92.8%
Corvus.Text.Json.JsonPath - 95.2%
Corvus.Text.Json.JsonPath.CodeGeneration - 96.1%
Corvus.Text.Json.OpenApi - 95.5%
Corvus.Text.Json.OpenApi.CodeGeneration - 98.5%
|
Contributor
Code Coverage Summary Report - Windows (net10.0)Summary
CoverageCorvus.Json.CodeGeneration - 80.5%
Corvus.Json.CodeGeneration.CSharp - 81.8%
Corvus.Json.ExtendedTypes - 74.9%
Corvus.Json.JsonReference - 76.7%
Corvus.Text.Json - 94.4%
Corvus.Text.Json.AsyncApi - 64.4%
Corvus.Text.Json.AsyncApi.Amqp - 0.6%
Corvus.Text.Json.AsyncApi.AzureServiceBus - 0%
Corvus.Text.Json.AsyncApi.CodeGeneration - 93.2%
Corvus.Text.Json.AsyncApi.Kafka - 0.6%
Corvus.Text.Json.AsyncApi.Mqtt - 0.9%
Corvus.Text.Json.AsyncApi.Nats - 0.4%
Corvus.Text.Json.AsyncApi.Polly - 100%
Corvus.Text.Json.AsyncApi.Testing - 96.6%
Corvus.Text.Json.AsyncApi.WebSocket - 0%
Corvus.Text.Json.CodeGeneration - 93.2%
Corvus.Text.Json.JMESPath - 93.8%
Corvus.Text.Json.JMESPath.CodeGeneration - 97.7%
Corvus.Text.Json.Jsonata - 91.6%
Corvus.Text.Json.Jsonata.CodeGeneration - 88.5%
Corvus.Text.Json.JsonLogic - 95.1%
Corvus.Text.Json.JsonLogic.CodeGeneration - 92.8%
Corvus.Text.Json.JsonPath - 95.2%
Corvus.Text.Json.JsonPath.CodeGeneration - 96.1%
Corvus.Text.Json.OpenApi - 95.5%
|
Contributor
Code Coverage Summary Report - Windows (net481)Summary
CoverageCorvus.Json.CodeGeneration - 80.6%
Corvus.Json.CodeGeneration.CSharp - 81.5%
Corvus.Json.ExtendedTypes - 72.6%
Corvus.Json.JsonReference - 73.8%
Corvus.Text.Json - 93.2%
Corvus.Text.Json.CodeGeneration - 86.2%
Corvus.Text.Json.JMESPath - 93.8%
Corvus.Text.Json.JMESPath.CodeGeneration - 97.7%
Corvus.Text.Json.Jsonata - 91.8%
Corvus.Text.Json.Jsonata.CodeGeneration - 88.6%
Corvus.Text.Json.JsonLogic - 95.1%
Corvus.Text.Json.JsonLogic.CodeGeneration - 92.8%
Corvus.Text.Json.JsonPath - 95.2%
Corvus.Text.Json.JsonPath.CodeGeneration - 96.1%
Corvus.Text.Json.Patch - 97.5%
Corvus.Text.Json.Toon - 88.2%
Corvus.Text.Json.Validator - 95.5%
Corvus.Text.Json.Yaml - 90.8%
Corvus.Toon.SystemTextJson - 90%
Corvus.Yaml.SystemTextJson - 88.7%
|
Contributor
|
mwadams
deleted the
feature/910-906-message-whitespace-and-global-namespace
branch
August 2, 2026 18:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #910. Fixes #906.
Two layered fixes, each root-caused and planned in its issue thread before implementation (#910 plan, #906 plan).
#910 — validation message whitespace (
db886368a0a)Validation messages are composed from a resource string that deliberately ends without trailing whitespace plus an appender that writes the quoted expected value.
AppendSingleQuotedValuewrites the separator space;AppendQuotedIntegerdid not, so every integer-valued message family (minLength/maxLength,minItems/maxItems,minContains/maxContains,minProperties/maxProperties, six comparison variants each) emitted...greater than or equal to'3'. The integer appender now writes the same leading space.The scan the issue asked for also found
JsonSchema_ExpectedLessThanreading "The value was expected to be greater than" in both resource copies (main library and the JsonLogic source generator), soexclusiveMaximumfailures reported the opposite direction. Both copies now read "less than".Test-first: 25 new exact-format assertions failed before the fix and pass after, pinning all 24 integer-valued message providers and the six number-comparison messages.
#906 — global-namespace source generation (
3c683101791)The generator's syntactic pre-filter required the attributed struct's parent to be a namespace declaration, so a global-namespace struct (parent
CompilationUnitSyntax) was silently dropped with no diagnostic. Behind the filter,ContainingNamespace.ToDisplayString()yields the literal<global namespace>string, and four emission sites assumed a non-empty namespace (namespace ...;lines and{ns}.{name}fully qualified names).The fix relaxes the filter, maps the global namespace to the empty string (matching the JMESPath/Jsonata/JsonLogic/JsonPath generators), and handles the empty namespace at the four emission sites. The default namespace used for shared generated types now prefers the first non-empty target namespace, so a global-namespace target cannot capture it regardless of spec collection order.
A
GlobalNamespaceModelstruct in the GeneratedModels project guards the regression through the real build on every TFM: silent non-generation now fails compilation, and four tests parse and schema-evaluate theoneOfshapes from the issue.Verification
Corvus.Text.Json.slnxbuilds after each fix.mimimummissing whitespace #910 (94,095 tests); 94,098/94,099 after SourceGenerator doesnt generate if in global namespace #906, with the single AsyncApi telemetry failure passing standalone and unrelated to these changes.C/directory — output is byte-for-byte identical for namespaced inputs (only lock-file timestamp churn, reverted).VERSIONHISTORY.mdgains the V5.2.13 entry.🤖 Generated with Claude Code
https://claude.ai/code/session_01EZZMVqcEwHxGUmVYGY8Rte