You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you override serialization method through serialization_strategy or field metadata as noted here for dataclass type or any type that is used inside Optional, this method's return type is not reflected in JSON Schema.
What I Did
First example:
fromdataclassesimportdataclassfrommashumaro.configimportBaseConfigfrommashumaro.jsonschemaimportbuild_json_schemadefdataclass_serialize(value) ->str:
returnstr(value)
@dataclassclassBar:
x: int@dataclassclassFoo:
bar: BarclassConfig(BaseConfig):
serialization_strategy= {
Bar: {"serialize": dataclass_serialize},
}
print(build_json_schema(Foo).to_json())
Description
When you override serialization method through
serialization_strategy
or field metadata as noted here for dataclass type or any type that is used insideOptional
, this method's return type is not reflected in JSON Schema.What I Did
First example:
Actual result
Expected result
Second example:
Actual result
Expected result
The text was updated successfully, but these errors were encountered: