mirror of
https://github.com/correl/tornado-openapi3.git
synced 2024-12-29 19:15:07 +00:00
Add a tornado-specific validator for convenience
This commit is contained in:
parent
e80db27aa9
commit
c81019df96
1 changed files with 6 additions and 0 deletions
|
@ -4,6 +4,7 @@ from openapi_core.validation.request.datatypes import ( # type: ignore
|
||||||
RequestParameters,
|
RequestParameters,
|
||||||
OpenAPIRequest,
|
OpenAPIRequest,
|
||||||
)
|
)
|
||||||
|
from openapi_core.validation.request import validators # type: ignore
|
||||||
from tornado.httputil import HTTPServerRequest
|
from tornado.httputil import HTTPServerRequest
|
||||||
from werkzeug.datastructures import ImmutableMultiDict, Headers
|
from werkzeug.datastructures import ImmutableMultiDict, Headers
|
||||||
|
|
||||||
|
@ -34,3 +35,8 @@ class TornadoRequestFactory:
|
||||||
"Content-Type", "application/x-www-form-urlencoded"
|
"Content-Type", "application/x-www-form-urlencoded"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class RequestValidator(validators.RequestValidator):
|
||||||
|
def validate(self, request: HTTPServerRequest):
|
||||||
|
return super().validate(TornadoRequestFactory.create(request))
|
||||||
|
|
Loading…
Reference in a new issue