angular / angular/angular-cli

Schematics schema should take custom validation functions

Abierto
#12,705 3 comentarios 1 reacción 0 asignados Ver en GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
14 h 23 min
PR fusionados (30 d)
162

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza rastreando cómo se validan los schematic schemas y cómo el prompt system gestiona la entrada de opciones; el issue nombra la schematic function como la solución alternativa actual. Se considera terminado cuando la validación personalizada definida por el schema puede cubrir casos entre opciones y basados en el sistema de archivos, validar la entrada durante el prompting y volver a solicitarla cuando la entrada no es válida.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
cli, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.