mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-22 03:00:10 +00:00
parameters/body should catch all schema errors
This commit is contained in:
parent
6bdd1a6756
commit
b66ec04ac2
2 changed files with 6 additions and 6 deletions
|
@ -4,7 +4,7 @@ from collections import defaultdict
|
|||
from json import loads
|
||||
|
||||
from openapi_core.schema.media_types.exceptions import InvalidMediaTypeValue
|
||||
from openapi_core.schema.schemas.exceptions import InvalidSchemaValue
|
||||
from openapi_core.schema.schemas.exceptions import OpenAPISchemaError
|
||||
|
||||
|
||||
MEDIA_TYPE_DESERIALIZERS = {
|
||||
|
@ -43,10 +43,10 @@ class MediaType(object):
|
|||
|
||||
try:
|
||||
unmarshalled = self.schema.unmarshal(deserialized, custom_formatters=custom_formatters)
|
||||
except InvalidSchemaValue as exc:
|
||||
except OpenAPISchemaError as exc:
|
||||
raise InvalidMediaTypeValue(exc)
|
||||
|
||||
try:
|
||||
return self.schema.validate(unmarshalled, custom_formatters=custom_formatters)
|
||||
except InvalidSchemaValue as exc:
|
||||
except OpenAPISchemaError as exc:
|
||||
raise InvalidMediaTypeValue(exc)
|
||||
|
|
|
@ -10,7 +10,7 @@ from openapi_core.schema.parameters.exceptions import (
|
|||
EmptyParameterValue,
|
||||
)
|
||||
from openapi_core.schema.schemas.enums import SchemaType
|
||||
from openapi_core.schema.schemas.exceptions import InvalidSchemaValue
|
||||
from openapi_core.schema.schemas.exceptions import OpenAPISchemaError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -110,10 +110,10 @@ class Parameter(object):
|
|||
|
||||
try:
|
||||
unmarshalled = self.schema.unmarshal(deserialized, custom_formatters=custom_formatters)
|
||||
except InvalidSchemaValue as exc:
|
||||
except OpenAPISchemaError as exc:
|
||||
raise InvalidParameterValue(self.name, exc)
|
||||
|
||||
try:
|
||||
return self.schema.validate(unmarshalled, custom_formatters=custom_formatters)
|
||||
except InvalidSchemaValue as exc:
|
||||
except OpenAPISchemaError as exc:
|
||||
raise InvalidParameterValue(self.name, exc)
|
||||
|
|
Loading…
Reference in a new issue