advanced-rest-client / api-type-document

⛔️ DEPRECATED This component is being deprecated. Use `api-documentation` instead.
0 stars 2 forks source link

Union enum types missing information about enums #38

Open deiteris opened 3 years ago

deiteris commented 3 years ago

When enum is put in a union (or JSON schema enum with multiple types), the information about the enum is lost.

#%RAML 1.0
title: Test API
version: v1
mediaType: 'application/json'
protocols:
    - HTTPS

types:
  TestType: |
    {
        "type": ["string", "null"],
        "enum": ["test", null]
    }

While with JSON schema it's possible to understand what the values are (see the first screenshot below), with RAML union type the example is not rendered at all. image

#%RAML 1.0
title: Test API
version: v1
mediaType: 'application/json'
protocols:
    - HTTPS

types:
  TestType:
    type: string | integer
    enum: [5, "test", 1, "three"]

image

See "RAML 1.0 spec: Union type" section that demonstrates the same usage example: https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md#union-type