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

'content' not present at all in API Elements for parameter with no sample value #305

Closed
honzajavorek opened this issue Apr 21, 2016 · 3 comments

Comments

@honzajavorek
Copy link
Contributor

FORMAT: 1A
# Beehive API
## Honey [/honey{?param}]
### Remove [DELETE]
+ Parameters
    + nonexisting (string, required)
+ Response

The parameter gets parsed as:

protagonist @ 1.3.0

{
  "element": "member",
  "attributes": {
    "typeAttributes": [
      "required"
    ]
  },
  "content": {
    "key": {
      "element": "string",
      "attributes": {
        "sourceMap": [
          {
            "element": "sourceMap",
            "content": [
              [
                90,
                31
              ]
            ]
          }
        ]
      },
      "content": "nonexisting"
    },
    "value": {
      "element": "string"
    }
  }
}

protagonist @ 1.3.0-pre.1

{
  "element": "member",
  "attributes": {
    "typeAttributes": [
      "required"
    ]
  },
  "content": {
    "key": {
      "element": "string",
      "attributes": {
        "sourceMap": [
          {
            "element": "sourceMap",
            "content": [
              [
                90,
                31
              ]
            ]
          }
        ]
      },
      "content": "nonexisting"
    },
    "value": {
      "element": "string",
      "content": ""
    }
  }
}

Notice the change:

 "value": {
   "element": "string",
-  "content": ""
 }

Is this correct behavior or is it a bug?

@honzajavorek
Copy link
Contributor Author

The problem is that if there is no content property, even one of "" or null value, I can't say whether the thing is refracted element or the final value. My algorithm doesn't see content, so it considers the {"element": "string"} part to be the final value of the "value": {... node.

honzajavorek added a commit to apiaryio/dredd-transactions that referenced this issue Apr 21, 2016
@pksunkara
Copy link
Contributor

This is intended because we fixed the bug in #286

@honzajavorek
Copy link
Contributor Author

Makes sense. Took me a while to understand that Refract elements without content are completely valid part of Refract.

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

No branches or pull requests

2 participants