Skip to content

Swagger documentation now rendered anymore."Please indicate a valid Swagger or OpenAPI version field" #207

@empusas

Description

@empusas

When you use the latest version and after you fixed the issue with the pydantic version you don't get the usual swagger/openAPI screen as the file cannot be rendered. Instead you get this message:

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0

I am not familiar with FastAPI but it seems something was change between version 0.98.0 and 0.99.0 (current version is 0.103.2) that breaks the rendering. It might have something todo with the customer CSS in netpalm.

In order to fix the issue the specific version of FastAPI should be in the requirements.txt. Usually is bad practice to pin down a specific version, same as not providing any version et all. But in this case we can expect no further versions between 0.98.0 and 0.99.0 with security patches. Anyhow to stick with proper syntax I did changed this line in requirements.txt:

fastapi>=0.98.0,<0.99.0

rebuild containers and it is working again.

Off course this is only a quick fix, as you miss out on all security and functional updates for FastAPI. The proper way would be to solve the root cause why it is not rendered with FastAPI version >0.98.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions