Skip to content

Type-Injection not working #1254

@jolyons123

Description

@jolyons123

Hi,

my endpoint looks as follows:

@app.post(
    "/my/endpoint",
    openapi_name="My Endpoint",
    openapi_tags=["myendpoint"],
)
async def my_endpoint(
    request: Request, body: MyCustomRequestBody
) -> MyCustomResponse:

Both MyCustomResponse and MyCustomRequestBody inherit from TypedDict.

There are two Problems:

  • The OpenAPI endpoint does only document and recognize the MyCustomResponse
  • The MyCustomRequestBody is only recognized in OpenAPI if it inherits from roby.types.Body which is of no use to me because I need it as TypedDict or Pydantic
  • Regardless of inheriting from Body or TypedDict, MyCustomRequestBody is never of the expected type (class that inherits from robyn.types.body or TypedDict) but instead always is of type str and contains the JSON string.

Any help appreciated :)

Best regards,
John

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions