Path params:value is not a valid integer
why i get this?
#11572
-
First Check
Commit to Help
Example Codefrom fastapi import FastAPI
app = FastAPI()
@app.get("/a/{a}/b/{b}/c/{c}")
def read_root(a:str, b: str, c: int):
return {"a":a, "b": b, "c": c}
a = app.openapi()
print(a) Descriptionrun this app with i use this path params:
i get this:
i think the path params is not parser right? but when i open this url in my brower :
its return very well
in the swagger ui i found that:
it not parse my and then got this error:
and this is the openapi schema:
i also change the openapi version to 3.0.2 why i get this? Operating SystemmacOS Operating System DetailsNo response FastAPI Version0.99.1 Pydantic Version1.10.15 Python VersionPython 3.11.3 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I tried your code example and it works as expected.
How do you pass these params?
|
Beta Was this translation helpful? Give feedback.
-
There is a bug in current version of Swagger UI (swagger-api/swagger-ui#9928). To solve your problem you can pin Swagger UI version to 5.9.0 adding the following code to your project:
Full code example:
|
Beta Was this translation helpful? Give feedback.
There is a bug in current version of Swagger UI (swagger-api/swagger-ui#9928).
Latest version of FastAPI pins Swagger UI version to 5.9.0. But FastAPI 0.99.1 (which you use) uses latest version of Swagger UI, which contains mentioned bug.
To solve your problem you can pin Swagger UI version to 5.9.0 adding the following code to your project: