Align early SpecValidator rule specs with the later rule spec layout (spec only) - #208
Open
takayamaki wants to merge 4 commits into
Open
takayamaki wants to merge 4 commits into
takayamaki wants to merge 4 commits into
Conversation
…or_spec The rule specs for TypeNullIn30 and TypeArrayIn30 carried a second top-level describe covering the runtime behaviour of the feature they detect. Runtime specs belong next to the other SchemaValidator specs, following the placement used for exclusiveMinimum / exclusiveMaximum (ota42y#192), const (ota42y#200) and prefixItems (ota42y#202). No behaviour change; the examples are moved verbatim.
Replace the boolean `include_path_items:` helper flag with explicit `doc_with_path_items` / `doc_without_path_items` helpers over a shared `base_doc`, as the later rule specs do. Add the missing "3.1 document without components.pathItems" example so the spec covers all four version x usage combinations.
Split the single parameterised helper into `doc_with_<feature>` / `doc_without_<feature>` helpers over a shared `base_doc`, as the later rule specs do. Add the missing "3.1 document without the feature" example to each, so both specs cover all four version x usage combinations.
Split the single payload-taking helper into `doc_with_example` / `doc_without_example` / `doc_with_examples_array` helpers over a shared `base_doc`, as the later rule specs do. Add the missing "3.0 document without singular example" example so the spec covers all four version x usage combinations.
takayamaki
commented
Sep 12, 2026
| end | ||
| end | ||
|
|
||
| RSpec.describe 'runtime: type as Array semantic in 3.1' do |
Contributor
Author
There was a problem hiding this comment.
moved to spec/openapi_parser/schema_validator_spec.rb
| end | ||
| end | ||
|
|
||
| RSpec.describe 'runtime: type: "null" semantic' do |
Contributor
Author
There was a problem hiding this comment.
moved to spec/openapi_parser/schema_validator_spec.rb
| 'components' => { 'schemas' => { 'Sample' => { 'type' => 'string' } } }, | ||
| } | ||
| root = OpenAPIParser.parse(raw, strict_reference_validation: false) | ||
| root = doc_without_type_null('3.0.0') |
Contributor
Author
There was a problem hiding this comment.
The inline hash is replaced with the shared helper
|
|
||
| context 'with a 3.1 document using type as a plain string' do | ||
| it 'reports no violation' do | ||
| root = doc_without_type_array('3.1.0') |
Contributor
Author
There was a problem hiding this comment.
missing test case added
|
|
||
| context 'with a 3.1 document without type: "null"' do | ||
| it 'reports no violation' do | ||
| root = doc_without_type_null('3.1.0') |
Contributor
Author
There was a problem hiding this comment.
missing test case added
| end | ||
|
|
||
| context 'with a 3.1 document without components.pathItems' do | ||
| it 'reports no violation' do |
Contributor
Author
There was a problem hiding this comment.
missing test case added
| end | ||
|
|
||
| context 'with a 3.0 document without singular example' do | ||
| it 'reports no violation' do |
Contributor
Author
There was a problem hiding this comment.
missing test case added
takayamaki
marked this pull request as ready for review
September 12, 2026 01:17
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.
Spec-only follow-up to the SpecValidator series from #152.
No library code changes.
The rule specs added later in the series (#199 onwards) settled on a common layout:
base_dochelper that builds the document skeleton,with
doc_with_<feature>/doc_without_<feature>helpers on top of itinstead of one helper taking a flag or a payload argument
(3.1 with / 3.1 without / 3.0 with / 3.0 without / unknown version)
SchemaValidatorspecs,not inside the rule spec
The earlier rule specs predate that layout.
This PR brings four of them in line so the rule specs read the same way throughout.
Runtime specs moved out of rule specs
type_null_in_30_spec.rbandtype_array_in_30_spec.rbeach carried a second top-levelRSpec.describecovering the runtime behaviour of
type: "null"and array-formtype.Those examples move verbatim into
schema_validator_spec.rb,nested under the existing top-level describe next to the
construntime examples from #200.This matches where #192 (
integer_validator_spec.rb) and #202 (array_validator_spec.rb) put theirs.Helpers split, missing combinations added
PathItemsIn30: theinclude_path_items:boolean flag becomesdoc_with_path_items/doc_without_path_items.Adds the "3.1 document without
components.pathItems" example.TypeNullIn30/TypeArrayIn30: the single parameterised helper becomesdoc_with_<feature>/doc_without_<feature>.Adds the "3.1 document without the feature" example to each.
ExampleSingularDeprecation: the payload-taking helper becomesdoc_with_example/doc_without_example/doc_with_examples_array.Adds the "3.0 document without singular
example" example.The
ExclusiveMinimum/ExclusiveMaximum/NullableDeprecationspecs are left as they are.They already enumerate more combinations than the common layout
(3.0-style vs 3.1-style form,
truevsfalse), and reshaping them would only shuffle lines.Each commit passes
rake(rspec + steep) on its own.This PR touches none of the files changed by the two open
contentEncoding/contentSchemaPRs,so it can land in any order relative to them.