Uploaded image for project: 'TrueNAS'
  1. TrueNAS
  2. NAS-109903

Wrong openapi schema on {id} endpoints

    XMLWordPrintable

    Details

    • Impact:
      Low

      Description

      OpenAPI schema is broken for get methods on paths with `id`

      This snippet shows right schema:

      ```

        "/pool/dataset/id/{id}": {
         "delete": {
          "tags": [
           "pool.dataset"
          ],
          "responses": {
           "200": {
            "$ref": "#/components/responses/Success"
           },
           "401": {
            "$ref": "#/components/responses/Unauthorized"
           }
          },
          "parameters": [
           {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
             "title": "id",
             "type": "string"
            }
           }
          ],
      ```

      id parameter schema is correct. However, for `get` operation:

      ```

         "get": {
          "tags": [
           "pool.dataset"
          ],
          "responses": {
           "200": {
            "$ref": "#/components/responses/Success"
           },
           "401": {
            "$ref": "#/components/responses/Unauthorized"
           }
          },
          "parameters": [
           {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
             "type": "integer"
            }
           },
           {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
             "type": "integer"
            }
           },
           {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
             "type": "boolean"
            }
           },
           {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
             "type": "string"
            }
           },
           {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
             "type": "array",
             "title": "query-filters",
             "default": null,
             "items": {},
             "nullable": true
            }
           }
          ],
      ```

      The `id` parameter became an array.

        Attachments

          Attachments

            JEditor

              Activity

                People

                Assignee:
                waqar Waqar Ahmed
                Reporter:
                krichy Richard Kojedzinszky
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: