#Erroneous 'Location header' warning for pydantic ValidationError

1 messages · Page 1 of 1 (latest)

mental sage
#

Steps to reproduce:

  1. Create a FastAPI ChatGPT plugin using Pydantic
  2. Create a method with a Header() argument as a parameter, e.g.
    @router.get("/search",
    response_model=ChatGPTResponse,
    summary="""SUMMARY""",
    dependencies=auth_dependencies)
    async def search(request: Annotated[ChatGPTRequest, Depends()],
    openai_ephemeral_user_id: Annotated[str | None, Header(description="Temporary user ID (expires every 24 hours)")] = None,
    openai_conversation_id: Annotated[str | None, Header(description="ID of the ChatGPT conversation")] = None,
    openai_subdivision_1_iso_code: Annotated[str | None, Header(description="User locale, in ISO 639-1")] = None) -> ChatGPTResponse:
  3. Go to https://chat.openai.com/ , click GPT-4->Plugins->Plugin Store->Develop your own plugin->localhost:8000
  4. The validation is run, and returns a warning about the openapi spec
  5. Full text of the openAPI spec is attached for reference

Expected result:

There are no warnings produced. Though the ValidationError does indeed have a "loc" parameter (see spec), it is used to point to the location in code where a given validation has occurred - not the users's location

Actual result:
The validation returns warnings for the openapi spec: "In path /search, method get, operationId search_search_get, parameter openai-ephemeral-user-id has location header; ignoring

In path /search, method get, operationId search_search_get, parameter openai-conversation-id has location header; ignoring
In path /search, method get, operationId search_search_get, parameter openai-subdivision-1-iso-code has location header; ignoring"

Additional information

Browser: Chrome
OS: macOS
(but this is not browser-specific)