Commit d850048
authored
fix(const-to-enum): handle boolean schema in properties (#1845)
JSON Schema allows `true` as a shorthand for an empty schema that
accepts any value. The `constToEnum` transformer was failing when
encountering such boolean schemas in properties because the `hasConst`
type guard assumed the input was always an object.
This adds a type check to handle boolean schemas gracefully, preventing
runtime errors during transformation.
---
### Ask Yourself
- [x] Have you reviewed the [contribution
guide](https://github.com/cdklabs/json2jsii/blob/main/CONTRIBUTING.md)?
- [x] Have you reviewed the [breaking changes
guide](https://github.com/cdklabs/json2jsii/blob/main/CONTRIBUTING.md#breaking-changes)?1 parent 24b5759 commit d850048
3 files changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
312 | 326 | | |
313 | 327 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
110 | | - | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
| |||
0 commit comments