Skip to content

Connexion3 Failed to load API definition in the Swagger UI #1829

@vladislavkoz

Description

@vladislavkoz

Description

It works perfectly fine locally and it works fine during some time after deployment. But after some time returns 500 error code. API itself works fine and all end-points works fine. The issue with Swagger UI only.
Before we added an exception handler we had just 500 error with the default message saying that something went wrong or app overloaded.
Now we use the following error_handler:

def connexion_base_exception_handler(
    request: ConnexionRequest, exc: Exception
) -> ConnexionResponse:
    return ConnexionResponse(
        status_code=500,
        body=json.dumps({"error": str(exc)}),
        content_type="application/json",
    )

As a result, str(exc) is actually openapi.json content

Screenshot 2023-12-06 at 09 36 49 image

I've found the follwoing message in logs but we do not use "oneOf":
`Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^\/']['patternProperties']['^(get|put|post|delete|options|head|patch|trace)$']['properties']['requestBody']:

image

`

Expected behaviour

API definition loaded correctly

Additional info:

Output of the commands:

  • python --version python:3.10
  • pip show connexion | grep "^Version\:". connexion[flask]==3.0.3
  • starlette. 0.33.0 or 0.32.0.post1

openapi.yaml: openapi: 3.0.0

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