ajv-validator / ajv-validator/ajv-errors

Custom error messages for patternProperties

Đang mở
#35 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
289
Fork
21
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Is there any way where one can add custom error message for pathPattern attributes? Example:

Json schema:
```javascript
"patternProperties": {
"^[a-zA-Z0-9]*$":{
"properties": {
"model":{"type":"string"},
"made":{"type":"string"},
"year":{"type":"string"}
}
}
},
"additionalProperties":false
}
```
Json:
```javascript
{
"efgh56789": {
"model": "civic"
"made": "toyota"
"year": "2014"
}
}
```
Here, how to add custom error message (ex: Can contain only alphanumeric characters) for the attribute 'efgh56789' in above schema?
Note: The schema can be a nested schema where few of them are 'patternProperties' & few of them are regular ones.

I have asked the same question in SoF:
Ref: [link](https://stackoverflow.com/questions/59478158/using-custom-error-message-for-patternproperties-attribute-using-ajv-error-npm-m)

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

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.