danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 480 forks source link

MSON Data structures are not working on v2.2.1 #305

Open wangyan-dlut opened 7 years ago

wangyan-dlut commented 7 years ago

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??

CameronLonsdale commented 7 years ago

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)
jackbentley commented 7 years ago

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?