Skip to content

docs: a Swashbuckle schema filter for ranges and sets (#49, port of #605) - #606

Merged
CaffeinatedCoder merged 3 commits into
release/10.xfrom
docs/49-swashbuckle-schema-filter-10.x
Nov 30, 2026
Merged

CaffeinatedCoder merged 3 commits into
release/10.xfrom
docs/49-swashbuckle-schema-filter-10.x

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #49

The port of #605 (main) to release/10.x, cherry-picked with -x and adapted. Merge after #605. #49 closes when #605 merges into main.

Problem

As on main: Swashbuckle describes a range as an object of its properties, a value set as an object with values, count and isEmpty, and a RangeSet<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:

  • Range set branch: asks for RangeSet<,>, as this line's ValueRangesSchemaTransformer does. 10.x has no IRangeSet<,>.
  • Package: the test project references Swashbuckle.AspNetCore 10.3.1. It uses Microsoft.OpenApi 2.7.5, the major Microsoft.AspNetCore.OpenApi 10 uses. 11.x needs Microsoft.OpenApi 3. The doc says "tested against Swashbuckle 10".
  • Changelogs: the Docs: row goes under a new ### Added in [10.5.0] of the root and core changelogs.
  • Folded in, from docs: a Swashbuckle schema filter for ranges and sets (#49) #605's second commit: Replace also clears items. Swashbuckle writes a range set as a list of ranges, so a string schema kept an items entry. It was found here first: the new Assert.IsNull(blocks["items"]) failed on this line, and main gets the same fix.

Tests

SwashbuckleSchemaFilterTests (7) against Swashbuckle 10.3.1: all pass. Without the items line, the multirange test fails. AspNetCore 99 and conventions 422 pass.

🤖 Generated with Claude Code

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)
@CaffeinatedCoder CaffeinatedCoder added this to the 10.5.0 milestone Nov 30, 2026
@CaffeinatedCoder CaffeinatedCoder added documentation Improvements or additions to documentation area/json System.Text.Json and TypeConverter wire forms package/core Affects CodoMetis.ValueRanges labels Nov 30, 2026
@CaffeinatedCoder CaffeinatedCoder mentioned this pull request Nov 30, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 0d299ca into release/10.x Nov 30, 2026
11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the docs/49-swashbuckle-schema-filter-10.x branch November 30, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/json System.Text.Json and TypeConverter wire forms documentation Improvements or additions to documentation package/core Affects CodoMetis.ValueRanges

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant