Skip to content

fix: unwrap single non-object array items in allOf#23838

Open
RomiRand wants to merge 1 commit into
OpenAPITools:masterfrom
RomiRand:unwrap-single-allOf
Open

fix: unwrap single non-object array items in allOf#23838
RomiRand wants to merge 1 commit into
OpenAPITools:masterfrom
RomiRand:unwrap-single-allOf

Conversation

@RomiRand
Copy link
Copy Markdown

@RomiRand RomiRand commented May 20, 2026

Fixes #23837

This PR unwraps the entry of an allOf composed schema, if it is the only (non-object) item.


Summary by cubic

Normalizes allOf by unwrapping a single non‑object sub‑schema and turning null entries into nullable, fixing array item resolution and preventing invalid inline models. Renames the rule to SIMPLIFY_ONEOF_ANYOF_ALLOF and enables it by default. Resolves #23837.

  • Bug Fixes
    • Simplify allOf in OpenAPINormalizer: remove null entries by setting nullable, unwrap a single non‑object sub‑schema, skip when $ref is present, and clear allOf for primitive/boolean types in OAS 3.0; also normalize array items using the normalized schema.
    • Added tests and YAML covering allOf simplification (including single-schema enums); updated docs/configs and test options to the new rule name.

Written for commit ffaeff5. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@jpfinne
Copy link
Copy Markdown
Contributor

jpfinne commented May 20, 2026

@RomiRand could you move the code to the OpenApiNormalizer?

@RomiRand RomiRand force-pushed the unwrap-single-allOf branch from 1a0451d to ffaeff5 Compare May 22, 2026 18:23
@RomiRand
Copy link
Copy Markdown
Author

@RomiRand could you move the code to the OpenApiNormalizer?

@jpfinne Oh sure didn't realize, it's a big project 😅 I gave it a shot, ptal. Gotten bigger than anticipated, thought it makes sense to integrate with the existing oneOf/anyOf handling.. Lmk if a bigger diff like this should be avoided, or if renaming SIMPLIFY_ONEOF_ANYOF is too much of a breaking change

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.

[BUG] array schemas with single non-object allOf entry aren't resolved

2 participants