Skip to content

Detect OpenAPI 3.2 documents and add ordered version helpers to SpecValidator rules - #1

Closed
modosc wants to merge 2 commits into
masterfrom
openapi-3-2/version-detection
Closed

modosc wants to merge 2 commits into
masterfrom
openapi-3-2/version-detection

Conversation

@modosc

@modosc modosc commented Sep 18, 2026

Copy link
Copy Markdown

First PR of the OpenAPI 3.2 stack. openapi_version now returns :v3_2; Rule gains VERSION_ORDER + version_before?/version_at_least?; the existing 3.1 rules (NullableDeprecation, ExampleSingularDeprecation, ExclusiveMinimum/Maximum) now fire on 3.2 documents too.

🤖 Generated with Claude Code

takayamaki and others added 2 commits September 23, 2026 08:54
…ompare ranges (ota42y#209)

* Enumerate specs for a comparable openapi_version

List the cases for returning openapi_version as a Gem::Version,
for the version range helpers on SpecValidator::Rule,
and for the 3.1-or-later rules applied to 3.2 documents.

* Add version range helpers to SpecValidator::Rule

Rules compare the declared version with == against a Symbol today,
which cannot express "3.1 or later".
version_before? and version_at_least? take a boundary string
and compare against a Gem::Version, returning false for an unknown version.

* Return openapi_version as a Gem::Version and compare ranges in rules

openapi_version returned :v3_0 / :v3_1 / :unknown and every rule
compared it with ==, so a 3.2 document fell into :unknown and no
rule ran on it.

It now returns Gem::Version (prerelease dropped) or nil when the
field is missing or not a major.minor[.patch] string.
Rules use version_before?('3.1') / version_at_least?('3.1'),
so the 3.1-or-later rules (nullable, singular example,
Boolean exclusiveMinimum / exclusiveMaximum) also cover 3.2.

---------

Co-authored-by: fusagiko / takayamaki <takayamaki@users.noreply.github.com>
@modosc
modosc force-pushed the openapi-3-2/version-detection branch from 808130d to 2793569 Compare September 23, 2026 15:40
@modosc

modosc commented Sep 23, 2026

Copy link
Copy Markdown
Author

Superseded by upstream ota42y#209, which returns openapi_version as a Gem::Version and adds version_before?/version_at_least?. The rest of the stack now uses those helpers; #2 is based on master.

@modosc modosc closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants