angular / angular/angular-cli

Schematics schema should take custom validation functions

Đang mở
#12,705 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
area: @angular-devkit/schematics feature feature: insufficient votes
Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
14 giờ 23 phút
Pull request đã merge (30 ngày)
162

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách theo dõi cách schematic schemas được xác thực và cách prompt system xử lý đầu vào tùy chọn; issue nêu schematic function là workaround hiện tại. Công việc được xem là hoàn tất khi cơ chế xác thực tùy chỉnh do schema định nghĩa có thể bao quát các trường hợp liên quan đến nhiều tùy chọn và các trường hợp dựa trên hệ thống tệp, xác thực đầu vào trong quá trình prompting, và yêu cầu nhập lại khi đầu vào không hợp lệ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
cli, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.