angular / angular/angular-cli

Schematics schema should take custom validation functions

Offen
#12,705 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area: @angular-devkit/schematics feature feature: insufficient votes
Vorherrschende Sprache
TypeScript
Sterne
27k
Forks
11.8k
Ø Merge
14 Std. 23 Min.
Gemergte PRs (30 T.)
162

Beschreibung

### 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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit nachzuverfolgen, wie schematic schemas validiert werden und wie das prompt system die Eingabe von Optionen verarbeitet; das Issue bezeichnet die schematic function als aktuellen Workaround. Als erledigt gilt die Aufgabe, wenn schema-definierte benutzerdefinierte Validierung Fälle über mehrere Optionen hinweg und dateisystembasierte Fälle abdecken kann, Eingaben während des Promptings validiert werden und bei ungültigen Eingaben erneut zur Eingabe aufgefordert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
cli, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.