Skip to content
Discussion options

You must be logged in to vote

it appears to be a purely cosmetic issue in swagger ui, not a fastapi bug. I created a similar setup

from typing import Optional, List
import uuid

from fastapi import FastAPI, Query


app = FastAPI()


@app.get("/")
async def root(
    field0: Optional[uuid.UUID] = None,
    field: Optional[List[uuid.UUID]] = Query(default=None)
):
    return {"message": "Hello World"}

The corresponding swagger ui looks like this

as you said the description in swagger ui for the list is array[string] not array[string($uuid)], but the field is validated properly as a uuid in swagger ui

as well as correctly validated by pydantic

curl -X 'GET'   'http://127.0.0.1:8000/?field=3fa85f64-5717-4562-b3fc-2c963f…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
2 participants
Converted from issue

This discussion was converted from issue #4349 on February 27, 2023 22:15.