Schematics schema should take custom validation functions
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 14時間 23分
- マージ済み PR(30日)
- 162
説明
### 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.
コントリビューションガイド
調査の方向性
まず、schematic schemas がどのように検証され、prompt system がオプション入力をどのように処理しているかを追跡します。この issue では、現在の workaround として schematic function が挙げられています。完了条件は、schema で定義されたカスタム検証でオプション間のケースとファイルシステムベースのケースを扱え、prompting 中に入力を検証し、入力が無効な場合に再度プロンプトを表示できることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- cli, tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100