Repository navigation
Backlog fixes: #1021, #1022, #943, #953, #1049 and smaller issues (5.8.2) - #1051
Merged
Merged
Conversation
The generated Clone() of an immutable type copied unconditionally, although its documentation (and JsonElement.Clone()) says a clone of a clone costs nothing. It now returns the instance when its document is not disposable: a clone, or a document that is never disposed. Pooled documents report themselves disposable, so they are still copied. A mutable instance's document is always a builder, so its Clone() is unchanged. The example recipes and the benchmark C/ models are regenerated. The only change in them is the new lines (and lock-file metadata); regenerated files whose truncated names depend on the checkout's path keep their committed names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
…651) SourceGeneratorHelpers.GenerateCode() makes file names unique within one call, but a generator that calls it more than once gave AddSource the same hint name for types of the same name in different namespaces, and Roslyn threw. The hint name now carries a short FNV-1a hash of the type's namespace (the generation's namespace for a file with no type) before ".g.cs", so "Foo.g.cs" becomes "Foo.1a2b3c4d.g.cs". The V5 source generator generates once per compilation, so its names cannot clash and are unchanged. The test project references the V4 tools under an alias, and drops the V4 generator's private Microsoft.Bcl.Memory, which the tools bring at the central version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
Both runners ignored failures on the 73 leap-second cases in the format runs, "as in the C# runner". Neither port shares the C# date and time parsers that need it, and both pass every case without it: TypeScript 7966/7966 in every mode (compiled, --module, --collect basic, detailed and verbose) and Rust 7966/7966. The exception would only hide a regression, so it is removed. The C# runner keeps its exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
docs/RuntimeEvaluator.md and the TypeScript and Rust READMEs said every runner excluded draft4/optional/zeroTerminatedFloats.json and the leap-second cases, "matching the C# runner". The C# runner excludes no file (it runs all 7,967 cases) and ignores failures on the 73 leap-second cases; the TypeScript and Rust runners skip zeroTerminatedFloats.json and, since #988, ignore no failure. Each document now says what its runner does, with a table of all three in RuntimeEvaluator.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
The .NET idn-email check refused an address over 320 bytes of UTF-8 before it checked the parts, and the email and idn-email checks refused a local part over 64 bytes, and email an address over 320 bytes. The other ports (Rust and the ports built on its rules) limit only the domain, and V4's email check has no length limit. A domain of U-labels can meet its limit with more than 320 bytes in the address, so "a@" and four labels of fifty "é" (405 bytes, 227 characters as A-labels) was valid in Rust and not in .NET. Every limit but the domain's (253 characters as a host name, as A-labels for idn-email) is removed, and with them the difference recorded in PatternConformance.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
…d code (#1022) Generated code (V5 and V4) carried the match limit of a regular expression as a fixed 1 second. A generation now chooses it: --regexMatchTimeout on the CLI and regexMatchTimeout in the generator configuration, and the MSBuild properties CorvusTextJsonRegexMatchTimeout (V5 source generator) and CorvusJsonSchemaRegexMatchTimeout (V4). The value is a positive number of milliseconds, or -1 for none; 1,000 stays the default, so code generated without it is unchanged. It reaches every place the limit is written: the constructed and [GeneratedRegex] expressions, the shared compiled matchers, and the options a generated program loads the evaluator with. A pattern proved to match in linear time still has no limit. Any other value is refused: by the configuration schema in the CLI, and as an error of the source generators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
Contributor
The description of --nativeEnums says "a nested [Flags] enum", and Spectre.Console reads square brackets as markup, so "corvusjson jsonschema --help" failed with "Could not find color or style 'Flags'". The brackets are escaped. A test runs --help for every command the root help lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
TryApplyPatch and TryValidateAndApplyPatch took only JsonElement.Mutable. Each gains a generic overload for any generated mutable type (MySchema.Mutable), which applies the patch to the element's document and makes the element again from where the patch left it, so it refers to the patched value even when the patch replaces the root. Replacing the root (in JSON Patch, and in a merge patch given JsonElement.Mutable.From(...) of a generated type) cast the document to JsonDocumentBuilder<JsonElement.Mutable>, which a generated type's builder is not, and threw InvalidCastException. The root is now made from the document's first row, whatever the builder's type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
…'s defaults into the document (#953) Reading an absent property gives its schema default, but leaves the document as it is, so a system that reads the JSON without the schema does not see the default. ApplyDefaults() on the mutable element of a type with properties adds each absent property that has a default, with the default as its value, and then does the same inside each property whose type has properties of its own (including an object it has just added from a default). A present property keeps its value; a value that is not an object is left alone; array items are not visited; the result is not validated. ApplyDefaults is a reserved member name. docs/ConsumingGeneratedTypes.md says plainly that this changes the data: it adds the defaulted properties to the document, for sending to systems that do not apply the schema's defaults themselves. The example recipes and the benchmark C/ models are regenerated; the only change is the new method. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
…ill used Since V5.8.0 the runtime evaluator and the default generated code match patterns with Corvus.Regex.Ecma262, and take validity, the limits of size and the limit of a match from it. The translator pages still described the evaluator as compiling, caching and timing translations. They now say that the translation is used only for generated code under the DotNet engine (and its programs' [GeneratedRegex] tables) and by JsonSchemaEvaluator.ToDotNetPattern; that the evaluator reads only the translator's analysis of whether code units can change an answer; where each consumer refuses a pattern under each engine; that the dataset figures for the translation are from before V5.8.0; and that the match limit of generated code is set with --regexMatchTimeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
) Patterns across the ports said a port of the ECMA-262 engine to TypeScript was to follow. #1026 is closed as superseded: the TypeScript package's pattern and patternProperties stay with the host's RegExp, and its regex format is to get a grammar-only reader instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
…1049) A V5 generated type whose only core type is array, and which is not a tuple, now implements IReadOnlyCollection<T> of its item type, as V4's array types did, so it can be passed to an API that takes a collection and used with LINQ. It also has a public GetEnumerator() that returns the array enumerator, so foreach over the value itself does not allocate on .NET (on .NET Framework it allocates what EnumerateArray() does). The interface members are explicit. Types that are not pure arrays are unchanged. The example recipes and the benchmark C/ models are regenerated; the only change is the new members. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
…alidation throw (#1021) The parser accepts a string that holds the escape of half of a surrogate pair (such as "\ud800") or bytes that are not UTF-8, and such text is checked only when it is read. pattern, minLength, maxLength, enum, const, an asserted format and the keywords applied to property names threw InvalidOperationException for it, in the runtime evaluator, V5 generated types and V4 generated code. V5 (the runtime evaluator, eager code generation, and the generated types that run on it): - The evaluator unescapes a lone surrogate as its generalized UTF-8 bytes (the reader's unescape loop takes a flag tested only at its three error sites), so "\ud800" reads as the raw bytes ED A0 80 do. Escapes never take an exception path. - A keyword that reads characters (pattern, minLength, maxLength, an asserted format or content, and the same on property names) reports text that is not UTF-8 as not valid. Text the parser found all ASCII is not checked again; other text is checked once, with a vectorised check, in the interpreter, the strict plans, the generated helpers and the IL emitter's length shortcut. - A keyword that compares text (const, enum, uniqueItems, property names) finds such text equal only to the same text. The reader's comparison helpers unescape the same way, so JsonElement equality answers rather than throwing, and their debug assertion, which held only for whole strings and was given what follows a common prefix, is corrected. - The .NET Regex path no longer matches the empty string when the text does not transcode. V4: generated Validate methods, and the 39 built-in format types, catch InvalidOperationException only when the value's own string or property names are not well-formed (Validate.IsNotWellFormedText), and report the value as not valid (Validate.TextIsNotWellFormed). Any other exception still propagates. A keyword that looks up a property by name can report an object with such a name as not valid, because System.Text.Json unescapes the names it compares. Tests: a matrix of 961 cases in the runtime evaluator tests (11 malformed texts, as values and as names, against each keyword, interpreted and eager, parsed and builder documents, flag and collector modes, with well-formed controls); generated-type and equality tests; V4 tests over generated code with both regex engines. Against the old source the matrix fails 605 cases and the V4 tests 17 of 19. Of the 68,770 texts of the ECMA-262 test data's lone-surrogates.jsonl, none throws; the 11,517 that V8 matches are reported as not valid. PatternConformance.md records the behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3
mwadams
force-pushed
the
fix/backlog-2026-11
branch
from
November 2, 2026 17:28
00be466 to
e607831
Compare
Contributor
Code Coverage Summary Report - Windows (net10.0)Summary
CoverageCorvus.Json.CodeGeneration - 80.5%
Corvus.Json.CodeGeneration.CSharp - 68.3%
Corvus.Json.ExtendedTypes - 81.8%
Corvus.Json.JsonReference - 76.6%
Corvus.Text.Json - 88.9%
Corvus.Text.Json.AsyncApi - 71%
Corvus.Text.Json.AsyncApi.Amqp - 0.2%
Corvus.Text.Json.AsyncApi.AzureServiceBus - 0%
Corvus.Text.Json.AsyncApi.CodeGeneration - 93.5%
Corvus.Text.Json.AsyncApi.Kafka - 0.2%
Corvus.Text.Json.AsyncApi.Mqtt - 0.4%
Corvus.Text.Json.AsyncApi.Nats - 0.2%
Corvus.Text.Json.AsyncApi.Polly - 57.8%
Corvus.Text.Json.AsyncApi.Testing - 96.2%
Corvus.Text.Json.AsyncApi.WebSocket - 0.6%
Corvus.Text.Json.CodeGeneration - 67.2%
|
Contributor
Code Coverage Summary Report - Linux (net10.0)Summary
CoverageCorvus.Json.CodeGeneration - 80.4%
Corvus.Json.CodeGeneration.CSharp - 68.3%
Corvus.Json.ExtendedTypes - 81.8%
Corvus.Json.JsonReference - 76.4%
Corvus.Text.Json - 89%
Corvus.Text.Json.AsyncApi - 71%
Corvus.Text.Json.AsyncApi.Amqp - 0.2%
Corvus.Text.Json.AsyncApi.AzureServiceBus - 0%
Corvus.Text.Json.AsyncApi.CodeGeneration - 93.5%
Corvus.Text.Json.AsyncApi.Kafka - 0.2%
Corvus.Text.Json.AsyncApi.Mqtt - 0.4%
Corvus.Text.Json.AsyncApi.Nats - 0.2%
Corvus.Text.Json.AsyncApi.Polly - 57.8%
Corvus.Text.Json.AsyncApi.Testing - 96.2%
Corvus.Text.Json.AsyncApi.WebSocket - 0.6%
Corvus.Text.Json.CodeGeneration - 67.2%
Corvus.Text.Json.JMESPath - 93.8%
|
Contributor
Code Coverage Summary Report - Windows (net481)Summary
CoverageCorvus.Json.CodeGeneration - 78.7%
Corvus.Json.CodeGeneration.CSharp - 70.4%
Corvus.Json.ExtendedTypes - 80%
Corvus.Json.JsonReference - 73.6%
Corvus.Text.Json - 87.4%
Corvus.Text.Json.CodeGeneration - 51.7%
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%
|
Contributor
|
The documentation preview for this pull request has been removed. |
This was referenced Nov 4, 2026
Merged
This was referenced Nov 13, 2026
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 from the November backlog triage, one commit per fix, released as V5.8.2 (patch).
Closes #927, closes #651, closes #988, closes #987, closes #1029, closes #1022, closes #943, closes #953, closes #1049, closes #1021.
Commits
Clone()returns the instance when it is already a clone (its document is not disposable).emailandidn-emaillimit only the domain, as the other ports do.--regexMatchTimeout,regexMatchTimeout,CorvusTextJsonRegexMatchTimeout,CorvusJsonSchemaRegexMatchTimeout(milliseconds, or -1 for none; default 1,000, so code generated without it is unchanged).corvusjson jsonschema --helprenders again (Spectre markup in the--nativeEnumsdescription), with a test that runs--helpfor every command.InvalidCastException(JSON Patch and Merge Patch).ApplyDefaults(), which adds the absent defaulted properties to the document. The docs say plainly that it changes the data.IReadOnlyCollection<T>, with a publicGetEnumerator()(no allocation on .NET). This is the first half of Feature: True C# Polymorphism and naturally strongly typed DTOs #921; the second is V5: an option to make the schema-facing members of generated types internal #1050.const,enum,uniqueItems,JsonElementequality) find such text equal only to the same text. V4 catches the reader's exception only when the value's own text is not well-formed. Details in the commit message and PatternConformance.md.Example recipes and benchmark
C/models are regenerated in the commits that change the generator (#927, #953, #1049).Verification
dotnet build Corvus.Text.Json.slnx: 0 warnings, 0 errors.RunawayRecursionThroughDependentSchemaIsDetectedoverflows the stack before the depth guard trips. That happens on main too and is not changed here.lone-surrogates.jsonl, none throws.Still to come: an A/B timing of the UTF-8 check on the jsonschema-benchmark corpora, which needs the host pinned.
🤖 Generated with Claude Code
https://claude.ai/code/session_011rjLiHWYWRFfJb3dkSsnE3