Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Description is not displayed in the JSON schema defition #148

Open
zshamrock opened this issue Jul 28, 2020 · 0 comments
Open

Description is not displayed in the JSON schema defition #148

zshamrock opened this issue Jul 28, 2020 · 0 comments

Comments

@zshamrock
Copy link

zshamrock commented Jul 28, 2020

I have the following API Blueprint (just a snippet):

...
### Initiate sign-up [POST /v1/users/signup]

+ Attributes (object)
    + state_id (number)
    + count_id (number)
    + elements (array[Element], fixed-type)

+ Request (application/json)

        {
            "state_id": 27,
            "count_id": 10,
            "elements": [
                {
                    "id": 1,
                    "status": true,
                    "facts": [
                        "fact1",
                        "fact2",
                        "etc"
                    ]
                }
            ]
        }
...
# Data Structures

## Element (object)

+ id: 1 (number) - Element id
+ status: true (boolean) - Whether the particular element is present or not
+ facts: [""] (array[string]) - Supporting facts for the elements with the "status: true"

Initially elements in the JSON schema has not been expanded at all, and has been rendered as "elements": "array", unless I added the fixed-type as mentioned at #40.

Now JSON schema includes the Element type definition, although description is missing, i.e. this how Snowboard renders it:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "state_id": {
      "type": "number"
    },
    "count_id": {
      "type": "number"
    },
    "elements": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "number"
              },
              "status": {
                "type": "boolean"
              },
              "facts": {
                "type": "array"
              }
            }
          }
        ]
      }
    }
  }
}

And this how Apiary renders it:

image

See the description I highlighted. In various examples, on the internet, I see that JSON Schema supports this extra description field in the output, but Snowboard doesn't display it.

I expect as you already parsed the Data Structures block (as Element type has been processed), it should be not difficult to access the description of the field and put it into the JSON schema definition.

@zshamrock zshamrock changed the title Description is not displayed in the schema defition Description is not displayed in the JSON schema defition Jul 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant