Repository navigation
Commit 476ae0e
committed
fix(@angular/cli): support array options defined in oneOf schemas
Previously, `getSupportedTypes` in `json-schema.ts` only checked top-level `items` when determining if an `array` type in a JSON schema was supported on the CLI. Options like `allowedHosts` in `@angular/build:dev-server`, which define their `array` schema inside a `oneOf` alongside `boolean`, had their `array` type filtered out and were registered in Yargs as `boolean` only.
Additionally, when an option supports both `array` (or `string`) and `boolean`, Yargs parses bare flags (e.g. `--allowed-hosts`) as `[]` and `--allowed-hosts=true` as `['true']`. This change checks `oneOf`/`anyOf` subschemas for supported array items and coerces empty or boolean-like values to booleans when `boolean` is also a supported type.
Closes #339551 parent 88b43b9 commit 476ae0e
3 files changed
Lines changed: 138 additions & 2 deletions
File tree
- packages/angular
- build/src/builders/dev-server
- cli/src/command-builder/utilities
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
85 | 125 | | |
86 | 126 | | |
87 | 127 | | |
| |||
177 | 217 | | |
178 | 218 | | |
179 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
180 | 248 | | |
181 | 249 | | |
182 | 250 | | |
| |||
198 | 266 | | |
199 | 267 | | |
200 | 268 | | |
201 | | - | |
| 269 | + | |
202 | 270 | | |
203 | 271 | | |
204 | 272 | | |
| |||
372 | 440 | | |
373 | 441 | | |
374 | 442 | | |
| 443 | + | |
375 | 444 | | |
376 | 445 | | |
377 | 446 | | |
| |||
424 | 493 | | |
425 | 494 | | |
426 | 495 | | |
| 496 | + | |
427 | 497 | | |
428 | 498 | | |
429 | 499 | | |
| |||
442 | 512 | | |
443 | 513 | | |
444 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
445 | 522 | | |
446 | 523 | | |
447 | 524 | | |
448 | 525 | | |
449 | 526 | | |
450 | 527 | | |
451 | | - | |
| 528 | + | |
452 | 529 | | |
453 | 530 | | |
454 | 531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
231 | 245 | | |
232 | 246 | | |
233 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
234 | 292 | | |
235 | 293 | | |
236 | 294 | | |
| |||
0 commit comments