Schematics schema should take custom validation functions
- Lingua principale
- TypeScript
- Stelle
- 27k
- Fork
- 11.8k
- Merge medio
- 14h 23m
- PR unite (30g)
- 162
Descrizione
### Bug Report or Feature Request (mark with an `x`)
```
- [ ] bug report -> please search issues before submitting
- [x] feature request
```
### Desired functionality
I would like to be able to specify validation functions for options of a schematic in the schema. JSON Schema does have some [built-in validation](http://json-schema.org/latest/json-schema-validation.html#rfc.section.6), but this doesn't cover everything.
Here are a couple of examples that are not covered by JSON Schema:
- An option for the name of a new directory or file that should not match the name of an existing directory or file
- An option whose validity is based on a previous option's value
A workaround is to perform this type of validation within the schematic function itself, however, this is not the best possible user experience when using the prompt system. As a user, I would expect my input to be validated as I enter it, then re-prompted for if necessary. With this workaround, a user would need to re-invoke the program from the beginning if their input is found invalid within the schematic function.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia tracciando come vengono validati gli schematic schemas e come il prompt system gestisce l’input delle opzioni; l’issue indica la schematic function come workaround attuale. Il lavoro è completato quando la validazione personalizzata definita dallo schema può coprire i casi tra opzioni e quelli basati sul filesystem, validare l’input durante il prompting e richiedere nuovamente l’input quando non è valido.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- cli, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100