Repository navigation
docs: a Swashbuckle schema filter for ranges and sets (#49, port of #605) - #606
Merged
CaffeinatedCoder merged 3 commits intoNov 30, 2026
Merged
Conversation
Swashbuckle describes a type from its public properties: a range is an object with "length", a value set an object with "values", "count" and "isEmpty", a range set an array of those objects. None of it is what the API sends. docs/serialization.md gets a "Swashbuckle" section with a schema filter to copy, ValueRangesSchemaFilter, which gives each type the schema the documented Microsoft.AspNetCore.OpenApi transformer gives: the range and multirange literal as a string with its pattern, a value set as an array of unique elements. As with the transformer, the AspNetCore test project compiles the filter and SwashbuckleSchemaFilterTests holds the doc to it verbatim. The tests generate a real Swashbuckle 11.0.1 document both ways and check that the filter's patterns are the transformer's text. Port to release/10.x. Differences from main: the range set branch asks for RangeSet<,> where main asks for IRangeSet<,>, as this line's transformer does; the test project references Swashbuckle.AspNetCore 10.3.1 (Microsoft.OpenApi 2.7.5, as Microsoft.AspNetCore.OpenApi 10 uses); the changelog rows go into [10.5.0]. Folded in: the filter drops the "items" Swashbuckle writes for a range set, which is a list of ranges to it, and the multirange test asserts it (main gets the same fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ff379a0)
Open
…buckle-schema-filter-10.x # Conflicts: # AGENTS.md
This was referenced Nov 30, 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.
Closes #49
The port of #605 (
main) torelease/10.x, cherry-picked with-xand adapted. Merge after #605. #49 closes when #605 merges intomain.Problem
As on
main: Swashbuckle describes a range as an object of its properties, a value set as an object withvalues,countandisEmpty, and aRangeSet<TRange, T>as an array of range objects. The API sends none of these shapes.Change
The same filter, doc section, tests and changelog row as #605, with these differences:
RangeSet<,>, as this line'sValueRangesSchemaTransformerdoes. 10.x has noIRangeSet<,>.Swashbuckle.AspNetCore10.3.1. It uses Microsoft.OpenApi 2.7.5, the majorMicrosoft.AspNetCore.OpenApi10 uses. 11.x needs Microsoft.OpenApi 3. The doc says "tested against Swashbuckle 10".Docs:row goes under a new### Addedin[10.5.0]of the root and core changelogs.Replacealso clearsitems. Swashbuckle writes a range set as a list of ranges, so a string schema kept anitemsentry. It was found here first: the newAssert.IsNull(blocks["items"])failed on this line, andmaingets the same fix.Tests
SwashbuckleSchemaFilterTests(7) against Swashbuckle 10.3.1: all pass. Without theitemsline, the multirange test fails. AspNetCore 99 and conventions 422 pass.🤖 Generated with Claude Code