Schematics schema should take custom validation functions

Aperta
#12,705 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
typescript
Ambito
cli, tooling

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.

Descrizione

area: @angular-devkit/schematics feature feature: insufficient votes
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, 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.

Lingua principale
TypeScript
Stelle
27k
Fork
11.8k
Merge medio
16h 35m
PR unite (30g)
176

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angular-cli

Tutte le issue di angular/angular-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.