Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Parsed Refract of parameters isn't consistent with attributes - parser introduces value which isn't present in markup #286

Closed
honzajavorek opened this issue Apr 8, 2016 · 1 comment
Labels

Comments

@honzajavorek
Copy link
Contributor

I'm parsing the 07. Parameters.md example blueprint. There's following markup:

+ Parameters

    + limit (number, optional) - The maximum number of results to return.
        + Default: `20`

Using drafter -f json (v2.3.0-pre.1), it's parsed as

{
  "element": "member",
  "meta": {
    "description": "The maximum number of results to return."
  },
  "attributes": {
    "typeAttributes": [
      "optional"
    ]
  },
  "content": {
    "key": {
      "element": "string",
      "content": "limit"
    },
    "value": {
      "element": "number",
      "attributes": {
        "default": "20"
      },
      "content": 0
    }
  }
}

Notice the "content": 0 part. Nobody specified value of the parameter should be 0 in the original markup. If I try to provide following:

+ Attributes

    + limit (number, optional) - The maximum number of results to return.
        + Default: `20`

Then it's parsed as:

{
  "element": "object",
  "content": [
    {
      "element": "member",
      "meta": {
        "description": "The maximum number of results to return."
      },
      "attributes": {
        "typeAttributes": [
          "optional"
        ]
      },
      "content": {
        "key": {
          "element": "string",
          "content": "limit"
        },
        "value": {
          "element": "number",
          "attributes": {
            "default": 20
          }
        }
      }
    }
  ]
}

i.e. correctly, just with the default value.

@pksunkara pksunkara added the bug label Apr 8, 2016
@pksunkara
Copy link
Contributor

Similarily, we have issues with

# GET /{id}
+ Parameters
    + id
# GET /{id}
+ Parameters
    + id (boolean)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants