Skip to content

Comments

feat: alias single anyOf/allOf types#509

Open
perher wants to merge 1 commit intoomissis:mainfrom
perher:feature/subschema-alias
Open

feat: alias single anyOf/allOf types#509
perher wants to merge 1 commit intoomissis:mainfrom
perher:feature/subschema-alias

Conversation

@perher
Copy link
Contributor

@perher perher commented Jan 25, 2026

This PR adds optional support for "inlining" or "collapsing" a subtype when it declares a single subschema of anyOf/allOf type. When feature is enabled in config and all conditions are fulfilled (no extra properties should be defined) then an alias type is created instead of declaring a duplicate type.

There is always a a maintenance burden of supporting optional features, I think it is worth it in this case since overhead is quite small.

fixes #296

extracted from #473

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@37d54f2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/generator/schema_generator.go 75.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #509   +/-   ##
=======================================
  Coverage        ?   41.20%           
=======================================
  Files           ?       66           
  Lines           ?     5662           
  Branches        ?        0           
=======================================
  Hits            ?     2333           
  Misses          ?     3050           
  Partials        ?      279           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link

coderabbitai bot commented Feb 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Collapse anyOf with only one option?

2 participants