Skip to content

Use Serializer in extend_schema.parameters (use serializer as OpenApiParameter?) #418

@xuhuiding0612

Description

@xuhuiding0612

Hi This is actually a question, I did a lot of searches and can't find the suggested way to use serializer as OpenApiParameter:
Currently I am using this way:

extend_schema(
        operation_id="op1",
        description="",
        tags=["tag1"],
        parameters=[MyQueryParamSerializer],    <-
        request=MyRequestBodySerializer,
        responses={
            status.HTTP_200_OK: OpenApiResponse()
        }
)

This works for 0.16. But with the new version release three days ago (0.17).

It will start giving warnings starting tag 0.17.0 like:

error: List item 0 has incompatible type "Type[MyQueryParamSerializer]"; expected "OpenApiParameter"

So my question would be what's the preferred way to use Serializer(s) as OpenApiParameter(s)? Thanks for the answering and help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions