Is your feature request related to a problem? Please describe.
If we use basic types like str, int, float, bool as a serialization method, the generated JSON Schema will use Any because they don't have signature:
from dataclasses import dataclass
from yarl import URL
from mashumaro.config import BaseConfig
from mashumaro.jsonschema import build_json_schema
@dataclass
class Foo:
bar: URL
class Config(BaseConfig):
serialization_strategy = {
URL: {
"serialize": str
}
}
print(build_json_schema(Foo).to_json())
# {"type":"object","title":"Foo","properties":{"bar":{}},"additionalProperties":false,"required":["bar"]}
UserWarning: Type Any will be used for __main__.Foo.bar with overridden serialization method: no signature found for builtin type <class 'str'>
Describe the solution you'd like
Treat str, int, float, bool types as functions returning the same type.
Is your feature request related to a problem? Please describe.
If we use basic types like
str
,int
,float
,bool
as a serialization method, the generated JSON Schema will useAny
because they don't have signature:Describe the solution you'd like Treat
str
,int
,float
,bool
types as functions returning the same type.