Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set up a specific request body with extend_schema #1378

Open
lev-slinsen opened this issue Feb 4, 2025 · 0 comments
Open

Unable to set up a specific request body with extend_schema #1378

lev-slinsen opened this issue Feb 4, 2025 · 0 comments

Comments

@lev-slinsen
Copy link

lev-slinsen commented Feb 4, 2025

Unable to set up a specific request body with extend_schema.
The description in source files says:

    :param request: replaces the discovered ``Serializer``. Takes a variety of inputs
        - ``Serializer`` class/instance
        - basic types or instances of ``OpenApiTypes``
        - :class:`.PolymorphicProxySerializer` for signaling that the operation
          accepts a set of different types of objects.
        - ``dict`` with media_type as keys and one of the above as values. Additionally, in
          this case, it is also possible to provide a raw schema dict as value.

The first option works, as per the example in documentation. But it's unclear how to set up a custom dict. I've tried multiple different variations and usually it results in 2 options (regardless of my custom fields):

request={"field1": OpenApiTypes.STR, "field2": OpenApiTypes.STR, ...} >>> "string"
Yes, not even a json, just a single word "string".

And in some other cases I've seen this appear:

{
  "additionalProp1": "string",
  "additionalProp2": "string",
  "additionalProp3": "string"
}

Which clearly looks like a placeholder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant