apiaryio / drafter

API Blueprint Parser (C++)
https://apiblueprint.org/
MIT License
301 stars 54 forks source link

MSON: Complex samples are parsed as distinct values #639

Open abtris opened 9 years ago

abtris commented 9 years ago

@honzajavorek opened apiaryio/snowcrash#286

Protagonist version

"protagonist-experimental": "0.18.2"

MSON Specs

https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#44-sample

Example MSON (copy pasted from specs)

- list: *3, 4* (enum)

Result of parsing

{
  "name": {
    "literal": "...",
    "variable": false
  },
  "sections": [
    {
      "class": "memberType",
      "content": [
        {
          "class": "property",
          "content": {
            "name": {
              "literal": "list"
            },
            "valueDefinition": {
              "values": [
                {
                  "literal": "*3",
                  "variable": false
                },
                {
                  "literal": "4*",
                  "variable": false
                }
              ],
              "typeDefinition": {
                "typeSpecification": {
                  "name": "enum"
                }
              }
            }
          }
        }
      ]
    }
  ]
}

Expected

Probably sth like

                {
                  "literal": "3",
                  "variable": true
                },
                {
                  "literal": "4",
                  "variable": true
                }

Other possible option: the spec is wrong.

abtris commented 9 years ago

@pksunkara commented

I am going to look into this.

abtris commented 9 years ago

@pksunkara commented

Wrote a test case in pksunkara/286 branch which is failing currently.

abtris commented 9 years ago

@honzajavorek commented

:+1: thanks!

abtris commented 9 years ago

@pksunkara commented

@honzajavorek But the expected output should be the following:

                {
                  "literal": "3, 4",
                  "variable": true
                }
abtris commented 9 years ago

@honzajavorek commented

@pksunkara That would be imho very difficult to process by subsequent tooling (aka boutique).

abtris commented 9 years ago

@zdne commented

@pksunkara is this still an issue?

abtris commented 9 years ago

@pksunkara commented

@zdne Yes, we still haven't fixed this.