angular / angular/angular-cli

[Schematics CLI] Numeric strings in schematics options

Aperta
#24,360 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area: @angular-devkit/schematics-cli freq1: low type: bug/fix
Lingua principale
TypeScript
Stelle
27k
Fork
11.8k
Merge medio
14h 23m
PR unite (30g)
162

Descrizione

### Command

generate

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

From http://b/196605664.

Apparently you can't pass in a numeric value into a string argument in schematics. This appears to be interpreted as number and leads to a validation error.

### Minimal Reproduction

```
$ schematics run test --stringValue "1234"
Schematic input does not validate against the Schema: {"stringValue":1234}
Errors:

Data path ".stringValue" should be string.
```

Minimist seems to interpret "1234" as a number instead of a string, and schematics treats that as a type mismatch.

### Exception or Error

_No response_

### Your Environment

```text
See http://b/196605664.
```

### Anything else relevant?

_No response_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal parsing delle opzioni del comando generate e dalla gestione di minimist descritta nel report, quindi riproduci il comando con --stringValue "1234". Traccia il punto in cui il valore tra virgolette diventa un numero e verifica che i valori dall’aspetto numerico passati alle opzioni string raggiungano la validazione dello schema come stringhe.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.