swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Unable to pass required parameters in Swagger UI

Open marcominerva opened this issue 2 months ago • 1 comments

Q&A

  • OS: Windows 11
  • Browser: Edge
  • Version: 142.0.3595.94
  • Method of installation: via Swashbuckle.AspNetCore.SwaggerUI
  • Swagger-UI version: 5.30.2
  • Swagger/OpenAPI version: OpenAPI 3.1

Describe the bug you're encountering

I have the following OpenAPI definition:

"parameters": [
    {
      "name": "Size",
      "in": "query",
      "required": true,
      "schema": {
        "pattern": "^-?(?:0|[1-9]\\d*)$",
        "type": [
          "integer",
          "string"
        ],
        "format": "int32"
      }
    }
  ],

if I try the endpoint in the Swagger UI, when I enter a value for the parameter and then press the Execute button, I get this error:

Image

To reproduce...

This is the full OpenAPI definition:

{
  "openapi": "3.1.1",
  "info": {
    "title": "WebApi | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:5000/"
    }
  ],
  "paths": {
    "/test": {
      "get": {
        "tags": [
          "WebApi"
        ],
        "parameters": [
          {
            "name": "Size",
            "in": "query",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "WebApi"
    }
  ]
}

marcominerva avatar Nov 24 '25 14:11 marcominerva

This is happening for me as well.

coderdnewbie avatar Dec 07 '25 16:12 coderdnewbie