Repository navigation
Support boolean schemas (OpenAPI 3.1) - #216
Merged
Merged
Conversation
A schema of true or false crashed the loader with NoMethodError, because it read keywords from the raw value as a Hash. A boolean schema is now a Schema with no keywords set.
items: false after prefixItems now rejects an element past the prefix. The new FalseSchemaError reports the schema that rejected the value.
These already pass with the previous two changes.
A Schema with no keywords rejected null through the nil validator.
These already pass with the previous changes.
3.0 allows a boolean only for additionalProperties.
These already pass, including additionalProperties: false in a 3.0 document.
takayamaki
marked this pull request as ready for review
October 19, 2026 18:00
1 of 8 tasks
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.
Part of #215 (item 1).
A boolean schema (
trueorfalsein place of a schema object) crashed the loader withNoMethodError.For example,
prefixItemswithitems: falsecould not be loaded.Changes
Schemawith no keywords set.schema.itemsand other schema attributes still return aSchema, so code that walks the schema tree keeps working.trueaccepts any value, includingnull.falserejects any value with the newFalseSchemaError.SpecValidatorruleBooleanSchemaIn30reports a boolean schema in a 3.0 document.3.0 allows a boolean only for
additionalProperties.additionalProperties: true/falsedoes not change.It is still loaded as a plain boolean.
I did not load boolean schemas as plain values, like
additionalProperties.Then schema attributes could return
trueorfalse, and code that calls methods on them would break.