Comments (11)
I want to request data in form data not in JSON how can I change that in yasg ? by default it is json form I want it to be in form data form @axnsan12
from drf-yasg.
Hello,
I am sorry but I do not really understand your question. The data node is the request body. It is what is sent in the body part of a POST/PUt/PATCH request.
You can get rid of it by not using request_body...
from drf-yasg.
it's ok, if it should be like that (please, close the issue in the case).
PS.
previously when i created swagger docs manually, all the body params are displayed without "data" node in the doc.
from drf-yasg.
...and old rdf swagger doc generators do it the same "no data" way:
from drf-yasg.
It seems to me that those are form parameters, not JSON body parameters. You will find that this library generates the same format for form requests (i.e. if your remove json renderers/parsers from the view).
However you will also find that form parameters do not support nesting, and the library your are referencing above would probably incorrectly represent any nested serializers in the request body as a plain string value.
from drf-yasg.
You might find this an interesting read; http://drf-yasg.readthedocs.io/en/stable/custom_spec.html#swagger-spec-overview
Specifically the part about Schema vs Parameter.
from drf-yasg.
Maybe an option to prefer form parameters could be useful for cases where there is no nesting?
from drf-yasg.
@axnsan12
thanks.
it works well when DEFAULT_PARSER_CLASSES is set to FormParser/MultiPartParser.
from drf-yasg.
Glad it worked out for you!
from drf-yasg.
@axnsan12 thread necromancy, but related to your earlier comment. I found a way to make form parameters support nesting. Is there a place to contribute this as a recipe?
from drf-yasg.
https://drf-yasg.readthedocs.io/en/stable/custom_spec.html#swagger-spec-overview
- request_body
@swagger_auto_schema(methods=['put', 'post'], request_body=UserSerializer)
from drf-yasg.
Related Issues (20)
- get_schema_fields breaks when using django-filters after last update HOT 2
- Redirect URL is not being processed in Django 4.2 when using oauth2 implicit flow HOT 1
- coreschema does not get installed with 1.21.6 HOT 4
- Can I use swagger_auto_schema in generic views?
- Vulnerability Issue
- `SerializerMethodField` return type is always 'STRING' when a file uses `from __future__ import annotations` due to PEP 563 HOT 2
- Animation not working on brave browser
- swagger_serializer_method does not work with partialmethod
- Headers Not Getting Sent Along with Request!
- Wrong Base URL: localhost HOT 2
- Add Python 3.12 Support HOT 3
- from pkg_resources import DistributionNotFound, get_distribution `ModuleNotFoundError: No module named 'pkg_resources`
- Export enums with drf-yasg to Swagger: Works in responses serializers but not in query_serializer
- Showing the read_only fields in the serializer in the post /swagger template in (ForignKeyFields)
- Django5 not supported? HOT 1
- tags hierarchy (sub-tags grouping)
- How can i remove default urls generated by base_url of router from swagger ui ??
- django_filters is not compatible
- Login with JWT
- filters.ModelChoiceFilter not looks like filters.ChoiceFilter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drf-yasg.