Schematics schema should take custom validation functions

Abierto
#12,705 3 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

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

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.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
16 h 35 min
PR fusionados (30 d)
176

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de angular/angular-cli

Todos los issues de angular/angular-cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.