aglio
aglio copied to clipboard
Arrays in JSONSchema do not contain `items` field
Hey,
Using the example blueprint, with master (and overriding protagonist to version 1.3.0-dev.0), I'd expect the output JSONSchema to be the same as the example render.
Right now, I get a discrepancy in the 200 Response
in the GET /notes
endpoint.
Expected:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique identifier"
},
"title": {
"type": "string",
"description": "Single line description"
},
"body": {
"type": "string",
"description": "Full description of the note which supports Markdown."
}
},
"required": [
"id",
"title"
]
},
"$schema": "http://json-schema.org/draft-04/schema#"
}
Actual:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "array"
}
This is related to this drafter issue: https://github.com/apiaryio/drafter/issues/211
I'd expect the output JSONSchema to be the same as the example render.
In fact, I tried to render example.apib with current aglio (npm install -g aglio
) and I got "type": "array"
, not what default.html promised me. Is it regression, or should I use some other version, or something else?
A workaround is to remove/do not mention the media type 'application/json' - without that it is working as expected. See the last comments in the issue https://github.com/danielgtaylor/aglio/issues/155
Good to know about the workaround, but I don't know how useful it is since the cost is getting rid of useful documentation :(.
we ended up writing application / json
(see spaces) :(