Repository navigation
fix: resolve allOf field types in OpenAPI compatibility guard - #512
Conversation
commit: |
|
LGTM |
There was a problem hiding this comment.
✅ Approved — This is a small, correct fix. The guard now follows single-member allOf wrappers to find a field's type, still treats multi-member allOf as ambiguous, and has regression tests. No issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
fieldType follows single-member allOf wrappers through deref for up to 10 levels, the same limit deref uses.
- A schema with more than one
allOfmember givesundefined. A conflicting schema therefore still stops generation with a clear staleness message. - When a schema has both
typeandallOf, the directtypewins. That matches what the guard did before this change.
The new tests cover inline, referenced and nested wrappers, a wrapped field whose type changed, and conflicting allOf members. Each test checks the exact staleness message or override result.
No changeset is needed because the change only touches the internal generator guard.
📝 Documentation: ✅ LGTM
No documentation changes are needed for this internal generator fix.
Reviewed commit: faad0713
|
| mean | stddev | min | max | |
|---|---|---|---|---|
| PR | 180.2 ms | 3.9 ms | 173.2 ms | 188.3 ms |
| base | 183.5 ms | 2.4 ms | 176.8 ms | 186.7 ms |
Δ (PR vs base): ↓ -3.3 ms (-1.8%)
Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.
The Update OpenAPI workflow fails when refreshing #477 because Precursor's
modeproperty now wraps its string schema inallOf: [$ref]. The temporary CLI flag guard only follows direct references, so it reports an undefined field type and stops generation. See the failed run.Follow single-member
allOfwrappers when checking field types, preserving--detection-modeand the existing checks for actual schema changes. Add regression coverage for inline, referenced, and nested wrappers, plus retyped and conflicting schemas.Validation:
pnpm checkpasses against both schemas.