apiaryio / drafter

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

Duplicit value in enumeration #749

Closed sixeyes closed 4 years ago

sixeyes commented 5 years ago

I've been busy with other projects for the last few months but returned to work on my API docs and discovered I now have 16 semantic errors, even though I've not changed the document. The errors are all:

Duplicit value in enumeration Line xxxx API Blueprint

They all refer to enumerations declared in Data Structures section

# Data Structures
## WaveRecord (object)

+ status: `Processed` (enum, required) - The wave status.
    + Members
        + `Draft` - The wave has been created but not queued.
        + `Processed` - The wave has been processed.
        + `Queued` - The wave has been queued but not processed.

The error line xxxx in this example refers to the + status: line. If I remove the Processed value I get an error indicating I've not supplied a value.

At the moment it's just a semantic error, but I'd like to know what's changed and what I can do to fix the warnings.

kylef commented 5 years ago

Hi @sixeyes, I think this looks like a bug in the parser (Drafter). Thank you for reporting, we'll debug this further and get the the bottom of the problem, for now I think you can ignore these warnings in your document.

kylef commented 4 years ago

Parse Result:

{
                        "element": "enum",
                        "attributes": {
                          "enumerations": {
                            "element": "array",
                            "content": [
                              {
                                "element": "string",
                                "attributes": {
                                  "typeAttributes": {
                                    "element": "array",
                                    "content": [
                                      {
                                        "element": "string",
                                        "content": "fixed"
                                      }
                                    ]
                                  }
                                },
                                "content": "Processed"
                              },
                              {
                                "element": "string",
                                "meta": {
                                  "description": {
                                    "element": "string",
                                    "content": "The wave has been created but not queued."
                                  }
                                },
                                "attributes": {
                                  "typeAttributes": {
                                    "element": "array",
                                    "content": [
                                      {
                                        "element": "string",
                                        "content": "fixed"
                                      }
                                    ]
                                  }
                                },
                                "content": "Draft"
                              },
                              {
                                "element": "string",
                                "meta": {
                                  "description": {
                                    "element": "string",
                                    "content": "The wave has been queued but not processed."
                                  }
                                },
                                "attributes": {
                                  "typeAttributes": {
                                    "element": "array",
                                    "content": [
                                      {
                                        "element": "string",
                                        "content": "fixed"
                                      }
                                    ]
                                  }
                                },
                                "content": "Queued"
                              }
                            ]
                          }
                        },
                        "content": {
                          "element": "string",
                          "attributes": {
                            "typeAttributes": {
                              "element": "array",
                              "content": [
                                {
                                  "element": "string",
                                  "content": "fixed"
                                }
                              ]
                            }
                          },
                          "content": "Processed"
                        }
                      }
                    }

Actual:

element: enum
attributes:
  enumerations:
    - `Processed`
    - `Draft` - The wave has been created but not queued.
    - `Queued` - The wave has been queued but not processed.
content:
  element: string
  content: Processed

Expectation:

element: enum
attributes:
  enumerations:
    - `Draft` - The wave has been created but not queued.
    - `Processed` - The wave has been processed.
    - `Queued` - The wave has been queued but not processed.
content:
  element: string
  content: Processed