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
It would be nice for the APIFlask wrapper to be modified to make it easier to replace Marshmallow with our own serializer/reserialize and schema generator.
I've managed to this with some patching but would be nice if it was a first-class concern.
I've managed to do this in my case by wrapping the APIBlueprint class with my CAttrsAPIBlueprint class that replaces the input and output attributes with the same logic but uses a cattrs converter to serialize and deserialize and jsonschema_extractor to extract out the JSON schema. So far, this is working well.
I'd imagine making this first-class wouldl be something along the lines of,
Thanks. I would love to have this in APIFlask. But I think it's not easy since the code is heavily coupled with marshmallow projects. Maybe we could implement this in 3.0.
It would be nice for the APIFlask wrapper to be modified to make it easier to replace Marshmallow with our own serializer/reserialize and schema generator.
I've managed to this with some patching but would be nice if it was a first-class concern.
I've managed to do this in my case by wrapping the
APIBlueprint
class with myCAttrsAPIBlueprint
class that replaces the input and output attributes with the same logic but uses a cattrs converter to serialize and deserialize and jsonschema_extractor to extract out the JSON schema. So far, this is working well.I'd imagine making this first-class wouldl be something along the lines of,
and input and output decorators would allow "Any" as the schema type.
@myblueprint.input(MyAttrsClass)
@myblueprint.output(MyOtherAttrsClass)
def my_endpoint(my_input: MyAttrsClass):
...
return (...)
The text was updated successfully, but these errors were encountered: