aglio icon indicating copy to clipboard operation
aglio copied to clipboard

Arrays in JSONSchema do not contain `items` field

Open udoprog opened this issue 8 years ago • 5 comments

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"
}

udoprog avatar Mar 15 '16 10:03 udoprog

This is related to this drafter issue: https://github.com/apiaryio/drafter/issues/211

vbartacek avatar Mar 23 '16 07:03 vbartacek

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?

AlekSi avatar Apr 04 '16 15:04 AlekSi

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

vbartacek avatar May 24 '16 21:05 vbartacek

Good to know about the workaround, but I don't know how useful it is since the cost is getting rid of useful documentation :(.

udoprog avatar May 25 '16 00:05 udoprog

we ended up writing application / json (see spaces) :(

davibe avatar Sep 30 '16 09:09 davibe