Change active extensions to arrays instead of "1", "2", "3", etc

Trying to write an OpenAPI spec for the Helix API, and your /users/extensions endpoint is bad form. Ideally this should be panel: [] rather than 1, 2, 3, etc, which can’t be defined in OpenAPI.

{
  "data": {
    "panel": {
      "1": {
        "active": true,
        "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0",
        "version": "1.1.0",
        "name": "TopClip"
      },
      "2": {
        "active": true,
        "id": "wi08ebtatdc7oj83wtl9uxwz807l8b",
        "version": "1.1.8",
        "name": "Streamlabs Leaderboard"
      },
      "3": {
        "active": true,
        "id": "naty2zwfp7vecaivuve8ef1hohh6bo",
        "version": "1.0.9",
        "name": "Streamlabs Stream Schedule & Countdown"
      }
    },
    "overlay": {
      "1": {
        "active": true,
        "id": "zfh2irvx2jb4s60f02jq0ajm8vwgka",
        "version": "1.0.19",
        "name": "Streamlabs"
      }
    },
    "component": {
      "1": {
        "active": true,
        "id": "lqnf3zxk0rv0g7gq92mtmnirjz2cjj",
        "version": "0.0.1",
        "name": "Dev Experience Test",
        "x": 0,
        "y": 0
      },
      "2": {
        "active": false
      }
    }
  }
}

“bad form” in your opinion but perfectly valid, I’ve seen worse.

Thats a string containing the word 1, 2 and 3.

Effectively it’s a slot called 1, 2 and 3.

The slots are not a zero indexed array… it’s a object with named slots

Since you CAN have:

{
  "data": {
    "panel": {
      "1": {
        "active": true,
        "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0",
        "version": "1.1.0",
        "name": "TopClip"
      },
      "2": {
        "active": false
      },
      "3": {
        "active": true,
        "id": "naty2zwfp7vecaivuve8ef1hohh6bo",
        "version": "1.0.9",
        "name": "Streamlabs Stream Schedule & Countdown"
      }
    }

Sure that would be fine as an array, but it’s not an array it’s got named slots

Here’s the problem: How is this documented in OpenAPI?

Something along the lines of

paths:
  /users/extensions:
    get:
      description: "asd"
      responses:
        default:
          $ref: "#/components/schemas/objectOfPanels"
            
components:
  schemas:
    objectOfPanels:
      $ref: "#/components/schemas/panels"
    panels:
      type: object
      required:
      - '1'
      - '2'
      - '3'
      properties:
        '1':
          $ref: "#/components/schemas/panel"
        '2':
          $ref: "#/components/schemas/panel"
        '3':
          $ref: "#/components/schemas/panel"
    panel:
      type: object
      required:
      - active
      properties:
        active:
          type: boolean
        id:
          type: string
        version:
          type: string
        name:
          type: string

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.