drafter icon indicating copy to clipboard operation
drafter copied to clipboard

Wrong expanded refract for the circular enums

Open pksunkara opened this issue 6 years ago • 1 comments

## GET /
+ Response 200 (application/json)
    + Attributes (array)
        - (A)
        - (B)

## Data Structures

## A (enum)
- (B)
- (array[B])

## B (enum)
- (A)
- (array[A])

The generated expanded refract looks wrong.

pksunkara avatar Aug 21 '18 12:08 pksunkara

Drafter 5.0.0 produces the following output:

{
  "element": "dataStructure",
  "content": {
    "element": "array",
    "content": [
      {
        "element": "A"
      },
      {
        "element": "B"
      }
    ]
  }
}

Where A is defined as:

{
  "element": "dataStructure",
  "content": {
    "element": "enum",
    "meta": {
      "id": {
        "element": "string",
        "content": "A"
      }
    },
    "attributes": {
      "enumerations": {
        "element": "array",
        "content": [
          {
            "element": "B"
          },
          {
            "element": "array",
            "content": [
              {
                "element": "B"
              }
            ]
          }
        ]
      }
    }
  }
}

B is defined as:

{
  "element": "dataStructure",
  "content": {
    "element": "enum",
    "meta": {
      "id": {
        "element": "string",
        "content": "B"
      }
    },
    "attributes": {
      "enumerations": {
        "element": "array",
        "content": [
          {
            "element": "A"
          },
          {
            "element": "array",
            "content": [
              {
                "element": "A"
              }
            ]
          }
        ]
      }
    }
  }
}

Which looks correct, expansion must not be working for circular nature of this API Blueprint.

kylef avatar Sep 28 '20 14:09 kylef