ajv-validator / ajv-validator/json-schema-migrate
attention points while converting draft-04 to draft-07
- Ngôn ngữ chính
- TypeScript
- Star
- 28
- Fork
- 4
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Hi,
I migrated the swagger v2.0 spec from [draft04](https://github.com/seriousme/openapi-schema-validator/blob/master/schemas.orig/v2.0/schema.json) to [draft07](https://github.com/seriousme/openapi-schema-validator/blob/master/schemas/v2.0/schema.json) and although the tool helped a lot (thanks for that !) I ran into a few issues I thought I'd share so maybe other people can benefit.
The swagger 2.0 spec contained a number of refs to the draft04 schema itself,e.g:
```json
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
},
```
I changed these by hand to:
```json
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-07/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger"
},
```
It would be nice if the tool would support this.
( "positiveInteger" being replaced by "nonNegativeInteger" was quite easy to spot ;-))
The second one took me a bit more time to figure out:
- json-schema-migrate incorrectly turned:
```json
"parametersList": {
"type": "array",
"description": "The parameters needed to send a valid API call.",
"additionalItems": false,
"items": {
"oneOf": [
{
"$ref": "#/definitions/parameter"
},
{
"$ref": "#/definitions/jsonReference"
}
]
},
"uniqueItems": true
},
```
into:
```json
"parametersList": {
"type": "array",
"description": "The parameters needed to send a valid API call.",
"additionalItems": false,
"items": [{
"oneOf": [
{
"$ref": "#/definitions/parameter"
},
{
"$ref": "#/definitions/jsonReference"
}
]
}],
"uniqueItems": true
},
```
which resulted in an error that the parameter list could only have 1 item. Removing the square brackets around the object in "items" again solved this one.
Thanks again,
Hans
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á.