Repository navigation
Describe System.Text.Json DOM types as free-form JSON in the OpenAPI document - #628
Merged
ipjohnson merged 2 commits intoOct 21, 2026
Merged
Conversation
GHSA-qhrr-8q5h-9q3h covers 3.0.0 through 3.1.8, and NU1902 is an error under ContinuousIntegrationBuild, so the Release build failed at restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Driver-Session: 2d7049bb-6fd8-4372-8d0f-661c0a5b9754
…document
JsonElement, JsonNode and JsonValue are written as {}, JsonObject as
{"type":"object"} and JsonArray as {"type":"array","items":{}}, matched by their
System.Text.Json and System.Text.Json.Nodes namespaces. The member walk skips
indexers, so no schema has a this[] property. verify-templates.sh builds the
Refit client of each code-first JSON Refit row over a probe handler that uses
the five types.
Closes #627
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Driver-Session: 2d7049bb-6fd8-4372-8d0f-661c0a5b9754
Merged
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.
Closes #627.
What changed
JsonSchemaWriternow writesJsonElement,JsonNodeandJsonValueas{},JsonObjectas{"type":"object"}andJsonArrayas{"type":"array","items":{}}. The types are matched by theirSystem.Text.Json/System.Text.Json.Nodesnamespace, so an application's ownJsonNodeis still reflected.ObjectRefskips indexers, so no schema has athis[]property. A nullableJsonObjectorJsonArraygetsnulladded to its type, which lowers tonullable: trueat 3.0.0, and a nullable{}stays{}.For the Refit criterion,
scripts/verify-templates.shcopiesscripts/probes/JsonDomController.csinto each code-first Refit row that uses the JSON serializer. It then builds the client project and checks that the DOM operations are in the generated client. This runs after the row's tests, because the scaffold'sDocumentStatusTestsfails on any operation it does not probe. The probe is removed afterwards.The separate commit bumps MessagePack from 3.1.8 to 3.1.9 for GHSA-qhrr-8q5h-9q3h, which was published on 2026-10-15. Without it, NU1902 fails the Release CI build at restore, on main as well. The template's pin and the two doc pages that cite the version move with it.
How it was tested
JsonDomDocumentTestscovers each of the five types as a property, a request body and a response. It runs the generated document through the export's lowering and YAML writer at 3.2.0, 3.1.0 and 3.0.0, and reads the YAML back with Microsoft.OpenApi to check it matches the JSON. It also checks that no component is written for the five types,JsonNodeOptionsorJsonValueKind, that a user type namedJsonNodeis still reflected, and that an indexer is not a property. The suite fails 25 tests against the old writer.scripts/verify-templates.sh kestrel:code:response:refit kestrel:code:throws:refit:nunitreports that the Refit client compiles over the DOM types on both rows. The overall run still fails on the Azure blob-trigger function row, because no storage emulator is listening on 127.0.0.1:10000 on this machine.dotnet build Hardened.slnx --configuration Release -p:ContinuousIntegrationBuild=truehas 0 warnings and 0 errors,dotnet test Hardened.slnxpasses across all 80 test assemblies, anddotnet csharpier check .is clean. No golden fixture or trackedopenapi/*.jsonchanged.🤖 Generated with Claude Code
Agent Driver: session 2d7049bb, Task 2052ce41 (Describe System.Text.Json DOM types as free-form JSON in the OpenAPI document), item describe-system-text-json-dom-types-as-f. Open on your network