Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork136
Customized format unmarshaller does not work for number type#827
-
Hello! cost:type:numberformat:decimal And the customized format unmarshaller is defined as follows: fromdecimalimportDecimaldeffloat_to_decimal(value):""" turn float format into Decimal object """returnDecimal(str(value))customized_extra_format_unmarshallers= {'decimal':float_to_decimal,}config=Config(extra_format_unmarshallers=customized_extra_format_unmarshallers)OpenAPI.from_file_path('index.yaml',config=config) But openapi-core ignores my customized_extra_format_unmarshallers, I would like the cost be a decimal object but it still return float data, is this a bug or is there any error in my setup? It would be helpful if there can be a workaround. Thank you! |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment 2 replies
-
Please check#821 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hello@p1c2u, Thanks a lot for the response! forschemainself.schema_validator.iter_valid_schemas(value):schema_validator=self.schema_validator.evolve(schema)primitive_type=schema_validator.get_primitive_type(value)ifprimitive_type!="string":continueif"format"inschema:returnstr(schema.getkey("format"))returnNone I believe it is the I am wondering will the function be open in the future? BTW many thanks for releasing the solution for#821 in short period! |
BetaWas this translation helpful?Give feedback.
All reactions
-
The condition was set to simplify the process otherwise we would have to pass type for each format unmarshaller. I hope in future we can support all types. |
BetaWas this translation helpful?Give feedback.