fix: handle schema ref siblings when downgrading#1031
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds targeted downgrading logic and tests to ensure OpenAPI 3.1 $ref siblings are properly converted to OpenAPI 3.0-compatible allOf structures without incorrectly rewriting non-schema payloads.
Changes:
- Added schema-aware downgrade pass that rewrites
$refsiblings intoallOfonly in OpenAPI schema locations. - Added regression tests for
$refsibling wrapping, preserving existingallOf, recursive schemas, and avoiding non-schema keys. - Added YAML-specific test assertions for
$refsibling wrapping behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| openapi.go | Splits downgrade into a generic transform pass + a schema-location-aware $ref-sibling rewrite pass. |
| openapi_test.go | Adds regression tests covering $ref sibling wrapping, recursion, YAML output, and non-schema “schema” keys in examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
34507f7 to
9f69869
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1031 +/- ##
==========================================
- Coverage 93.07% 92.24% -0.83%
==========================================
Files 23 23
Lines 4781 4916 +135
==========================================
+ Hits 4450 4535 +85
- Misses 271 306 +35
- Partials 60 75 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9f69869 to
6fa813f
Compare
Summary
$refsiblings to an OpenAPI 3.0-compatibleallOfwrapper during downgradeallOfentriesTests
GOCACHE=/tmp/huma-go-cache GOMODCACHE=/tmp/huma-go-mod-cache go test . -run TestDowngradeGOCACHE=/tmp/huma-go-cache GOMODCACHE=/tmp/huma-go-mod-cache go test ./...Fixes #1001