@@ -30,6 +30,24 @@ Django can be integrated by middleware. Add `DjangoOpenAPIMiddleware` to your `M
3030
3131 OPENAPI_SPEC = create_spec(spec_dict)
3232
33+ After that you have access to validation result object with all validated request data from Django view through request object
34+
35+ .. code-block :: python
36+ from django.views import View
37+
38+ class MyView (View ):
39+ def get (self , req ):
40+ # get parameters object with path, query, cookies and headers parameters
41+ validated_params = req.openapi.parameters
42+ # or specific location parameters
43+ validated_path_params = req.openapi.parameters.path
44+
45+ # get body
46+ validated_body = req.openapi.body
47+
48+ # get security data
49+ validated_security = req.openapi.security
50+
3351 Low level
3452~~~~~~~~~
3553
@@ -80,16 +98,16 @@ After that you will have access to validation result object with all validated r
8098
8199 class ThingsResource :
82100 def on_get (self , req , resp ):
83- # get parameters object with path, query, cookies and headers parameters
84- validated_params = req.context.openapi.parameters
85- # or specific location parameters
86- validated_path_params = req.context.openapi.parameters.path
101+ # get parameters object with path, query, cookies and headers parameters
102+ validated_params = req.context.openapi.parameters
103+ # or specific location parameters
104+ validated_path_params = req.context.openapi.parameters.path
87105
88- # get body
89- validated_body = req.context.openapi.body
106+ # get body
107+ validated_body = req.context.openapi.body
90108
91- # get security data
92- validated_security = req.context.openapi.security
109+ # get security data
110+ validated_security = req.context.openapi.security
93111
94112 Low level
95113~~~~~~~~~
0 commit comments