Skip to content

Support boolean schemas in OpenAPI 3.1 properties and composition keywords#279

Open
tarnishablec wants to merge 8 commits intox52dev:mainfrom
tarnishablec:copilot/fix-issue-278
Open

Support boolean schemas in OpenAPI 3.1 properties and composition keywords#279
tarnishablec wants to merge 8 commits intox52dev:mainfrom
tarnishablec:copilot/fix-issue-278

Conversation

@tarnishablec
Copy link

This pull request refactors the ObjectSchema struct to use the more general Schema type for several fields, allowing support for boolean schemas (true/false) in places like properties, allOf, anyOf, oneOf, and prefixItems. It also introduces comprehensive tests to ensure boolean schemas are handled correctly in both YAML and JSON formats, and adds a helper for resolving schemas. These changes address issue #278 and improve OpenAPI/JSON Schema compatibility.

Schema structure improvements

  • Updated the fields all_of, any_of, one_of, prefix_items, and properties in ObjectSchema to use Schema instead of ObjectOrReference<ObjectSchema>.
  • Added a Schema::resolve method to facilitate resolving schemas, including handling boolean schemas by returning an empty ObjectSchema.

Test coverage for boolean schemas

  • Enhanced tests to verify correct parsing and serialization of boolean schemas in properties, allOf, anyOf, oneOf, and prefixItems, including round-trip checks for YAML and JSON.
  • Updated existing tests to match the new structure, ensuring that references and inline schemas are correctly identified as Schema variants.

Copilot AI and others added 8 commits November 23, 2025 04:58
…ev#278)

Co-authored-by: tarnishablec <42984497+tarnishablec@users.noreply.github.com>
…xItems

Co-authored-by: tarnishablec <42984497+tarnishablec@users.noreply.github.com>
Co-authored-by: tarnishablec <42984497+tarnishablec@users.noreply.github.com>
Co-authored-by: tarnishablec <42984497+tarnishablec@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants