Commit 855fc9a
fix(core): restore Required<Pick> for allOf required fields lost after normalizeAllOfSchema
When an allOf schema had an inline member that listed a property in
`required` but the property was only defined on a sibling $ref member,
the generated TypeScript type emitted the property as optional instead
of required.
`normalizeAllOfSchema` (introduced to fix #2458) merges inline allOf
members into the parent schema, moving their `required` array onto
`normalizedSchema`. The `requiredProperties` initializer in
`combineSchemas` then read `schema.required` (always undefined on the
original schema in this pattern) instead of `normalizedSchema.required`,
so the promoted required fields were silently dropped and no
`Required<Pick<...>>` was emitted.
Fix: read `normalizedSchema.required` instead of `schema.required` when
initializing `requiredProperties`.
Closes #1670. Regression introduced by the normalizeAllOfSchema change
that fixed #2458.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent bb79bf7 commit 855fc9a
3 files changed
Lines changed: 37 additions & 4 deletions
File tree
- packages/core/src/getters
- tests/__snapshots__/mock/issue-2465/model
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
271 | 297 | | |
272 | 298 | | |
273 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
0 commit comments