Skip to content

Schema Object - "array" elements - mixed-up constraints and description #681

@ilPittiz

Description

@ilPittiz

When defining, within a Schema Object, an "array" element with both constraints (e.g. "minLength") and "description", they get mixed-up in unclear way.

RapiDoc version 9.2.0 (from CDN: https://unpkg.com/[email protected]/dist/rapidoc-min.js)

Example:

Schema
{
  "info": {
    "title": "Demo",
    "version": "0.0.1"
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/v1/demo": {
      "post": {
        "operationId": "demo",
        "description": "Demo API",
        "parameters": [],
        "responses": {
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "description": "Error key",
                      "type": "string",
                      "pattern": "^[a-z_]+$",
                      "minLength": 1
                    },
                    "invalidIds": {
                      "description": "List of invalid IDs",
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^ID[0-9]$"
                      },
                      "minItems": 1,
                      "maxItems": 1000
                    }
                  },
                  "required": [
                    "error",
                    "invalidIds"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "error": "invalid_id",
                  "invalidIds": [ "IDn" ]
                }
              }
            }
          }
        }
      }
    }
  }
}
Screenshot (comparison of "string" and "array" elements, both with constraints and description) schema_array_description

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions