Skip to content

An endpoint regestered with .get('') the generated openapi path ends in / #255

@lucastheisen

Description

@lucastheisen

Environment:

  • Python version: 3.12
  • Operating system: Rocky Linux 9
  • Flask version: 3.1.2
  • flask-openapi3 version: 4.3.1

When i created the following:

@hello_world_page.get('')
def hello() -> str:
    return ''

And register with:

    app.register_api(hello_world_page, url_prefix="/api/v1/hello")

It generates the following json:

    "/api/v1/hello/": {
      "get": {
        "operationId": "hello_world_hello_get",
        "responses": {
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ValidationErrorModel"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Unprocessable Entity"
          }
        },
        "tags": [
          "default"
        ]
      }
    },

Which is obviously incorrect because the trailing /

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions