Query param of type UUID is presented as array[string] instead of array[string($uuid)] when capturing lists #6483
-
First Check
Commit to Help
Example Codefrom fastapi import FastAPI
app = FastAPI()
@app.get("/test")
def get_query_params(
field_1: Optional[UUID] = None, # type on swagger: string($uuid) - OK
field_2: Optional[List[str]] = Query(None), # type on swagger: array[string] - OK
field_3: Optional[List[UUID]] = Query(None) # type on swagger: array[string] - NOT OK, Pydantic still validates it as an uuid.
):
return {"Hello", "World"}DescriptionOpen the browser and navigate to swagger docs on Operating SystemmacOS Operating System DetailsNo response FastAPI Version0.70.1 Python Version3.9.9 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Beta Was this translation helpful? Give feedback.
-
|
@ugtar thanks for your response! you are correct! it all works as expected, validation, formatting etc, seems to be purely visual from swagger docs, closing this issue. |
Beta Was this translation helpful? Give feedback.
-
|
...but you might still open an issue on https://github.com/swagger-api/swagger-ui |
Beta Was this translation helpful? Give feedback.


it appears to be a purely cosmetic issue in swagger ui, not a fastapi bug. I created a similar setup
The corresponding swagger ui looks like this
as you said the description in swagger ui for the list is
array[string]notarray[string($uuid)], but the field is validated properly as a uuid in swagger uias well as correctly validated by pydantic