|
14 | 14 | from openapi_core.schema.schemas.exceptions import (
|
15 | 15 | InvalidSchemaValue, UndefinedSchemaProperty, MissingSchemaProperty,
|
16 | 16 | OpenAPISchemaError, NoOneOfSchema, MultipleOneOfSchema, NoValidSchema,
|
17 |
| - UndefinedItemsSchema, InvalidCustomFormatSchemaValue, |
| 17 | + UndefinedItemsSchema, InvalidCustomFormatSchemaValue, InvalidSchemaProperty, |
18 | 18 | )
|
19 | 19 | from openapi_core.schema.schemas.util import (
|
20 | 20 | forcebool, format_date, format_datetime,
|
@@ -297,8 +297,11 @@ def _unmarshal_properties(self, value, one_of_schema=None,
|
297 | 297 | if not prop.nullable and not prop.default:
|
298 | 298 | continue
|
299 | 299 | prop_value = prop.default
|
300 |
| - properties[prop_name] = prop.unmarshal( |
301 |
| - prop_value, custom_formatters=custom_formatters) |
| 300 | + try: |
| 301 | + properties[prop_name] = prop.unmarshal( |
| 302 | + prop_value, custom_formatters=custom_formatters) |
| 303 | + except OpenAPISchemaError as exc: |
| 304 | + raise InvalidSchemaProperty(prop_name, exc) |
302 | 305 |
|
303 | 306 | self._validate_properties(properties, one_of_schema=one_of_schema,
|
304 | 307 | custom_formatters=custom_formatters)
|
@@ -539,6 +542,9 @@ def _validate_properties(self, value, one_of_schema=None,
|
539 | 542 | if not prop.nullable and not prop.default:
|
540 | 543 | continue
|
541 | 544 | prop_value = prop.default
|
542 |
| - prop.validate(prop_value, custom_formatters=custom_formatters) |
| 545 | + try: |
| 546 | + prop.validate(prop_value, custom_formatters=custom_formatters) |
| 547 | + except OpenAPISchemaError as exc: |
| 548 | + raise InvalidSchemaProperty(prop_name, original_exception=exc) |
543 | 549 |
|
544 | 550 | return True
|
0 commit comments