aglio icon indicating copy to clipboard operation
aglio copied to clipboard

MSON Data structures are not working on v2.2.1

Open wangyan-dlut opened this issue 9 years ago • 2 comments

When I write mson data structures in my api.md like this:

## Data Structures

### serversNum (object)

- `ip`: `string` (string)
- `num`: `0` (number) 

### onlineNum (object)

- `totalNum`: `0` (number) 
- `serversNum` (array[serversNum])

the json scheam it parsed is

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "totalNum": {
      "type": "number"
    },
    "serversNum": {
      "type": "array"
    }
  }
}

the schema of serversNum is missing! So How can I solve this problem??

wangyan-dlut avatar Oct 31 '16 12:10 wangyan-dlut

Hi @wangyan-dlut I encountered this problem recently. I'm not sure if this is the correct fix, but try using the type attribute fixed-type. This should fill out the schema for serversNum

- `serversNum` (array[serversNum], fixed-type)

CameronLonsdale avatar Dec 19 '16 03:12 CameronLonsdale

Makes sense to mark it with fixed-type, as arrays can contain multiple types. However, since the type is specified directly, it probably should be implied to be fixed-type.

In any case, I think this is an upstream issue with drafter/the spec it's self?

jackbentley avatar Mar 03 '17 22:03 jackbentley