Schematics schema should take custom validation functions
- Linguagem predominante
- TypeScript
- Estrelas
- 27k
- Forks
- 11.8k
- Merge médio
- 14h 23min
- PRs com merge (30d)
- 162
Descrição
### 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.
Guia de contribuição
Direção de pesquisa
Comece rastreando como os schematic schemas são validados e como o prompt system lida com a entrada de opções; a issue nomeia a schematic function como o workaround atual. O trabalho estará concluído quando a validação personalizada definida pelo schema puder abranger casos entre opções e casos baseados no sistema de arquivos, validar a entrada durante o prompting e solicitar a entrada novamente quando ela for inválida.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- typescript
- Domínio
- cli, tooling
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100