drafter icon indicating copy to clipboard operation
drafter copied to clipboard

MSON: Complex samples are parsed as distinct values

Open abtris opened this issue 10 years ago • 7 comments

@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 avatar Feb 04 '15 19:02 abtris

@pksunkara commented

I am going to look into this.

abtris avatar Feb 05 '15 11:02 abtris

@pksunkara commented

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

abtris avatar Feb 05 '15 15:02 abtris

@honzajavorek commented

:+1: thanks!

abtris avatar Feb 05 '15 19:02 abtris

@pksunkara commented

@honzajavorek But the expected output should be the following:

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

abtris avatar Feb 06 '15 13:02 abtris

@honzajavorek commented

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

abtris avatar Feb 06 '15 13:02 abtris

@zdne commented

@pksunkara is this still an issue?

abtris avatar Apr 23 '15 00:04 abtris

@pksunkara commented

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

abtris avatar Apr 23 '15 05:04 abtris