drafter
drafter copied to clipboard
Fixed array with a mixin inside produces incorrect json schema
Suppose we have the next apib:
# My API
# Group Example
# GET /
+ Response 200 (application/json)
+ Attributes (array, fixed)
+ Karlin
+ Include Address
# Data Structures
## Address (array)
+ Prague
+ Wendy's
It produces the next json schema, which looks like a bug:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"minItems": 2,
"items": [
{
"const": "Karlin"
},
{
"type": "array",
"minItems": 2,
"items": [
{
"const": "Prague"
},
{
"const": "Wendy's"
}
],
"additionalItems": false
}
],
"additionalItems": false
}
Expected result:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"minItems": 3,
"items": [
{
"const": "Karlin"
},
{
"const": "Prague"
},
{
"const": "Wendy's"
},
],
"additionalItems": false
}
Produced body is correct:
[
"Karlin",
"Prague",
"Wendy's"
]
Used environment:
$ drafter -v
v5.0.0