apiaryio / drafter

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

Old Parameter syntax should give warning when encountering Members #634

Open abtris opened 8 years ago

abtris commented 8 years ago

@klokane opened apiaryio/snowcrash#355

As say Blueprint specification: https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#def-uriparameters-section

Members is the optional enumeration of possible values. <type> should be surrounded by enum[] if this is present. For example, if enumeration values are present for a parameter whose type is number, then enum[number] should be used instead of number to.

But following definition is parsed without any warning or error

FORMAT: 1A
​
# Polls API Root [/]
​
## Questions collection [/questions{?page}]
​
+ Parameters
    + page (optional, number) ... The page of questions to return
        + Default: `2`, `3`

        + Members
            + 1
            + 2
            + 3

Valid definition should be+ page (optional, enum[number]) original definition should generate warning like URI parameter section for primitive types does not allows member section definition

abtris commented 8 years ago

@pksunkara commented

page (optional, number) ... The page of questions to return

implies the parameter is old syntax. Which means it doesn't need the enum[] part. Members is new syntax enumeration which gets ignored since the parameter is old syntax.

+ page (optional, number) ... The page of questions to return
    + Default: 2
    + Values
        + 1
        + 2

is the actual correct thing here.

abtris commented 8 years ago

@klokane commented

@XVincentX is it response to your question?

abtris commented 8 years ago

@pksunkara commented

I have edited the issue to a better description and finalised the action that needs to be taken here.