Open MajorDallas opened 3 years ago
We definitely need this feature.
this is a MUST feature
Is there any solution or workaround to this in 2023?
So basically the most trivial example is not supported? We can't use marshal when there are multiple possible http codes, so... always?
Is your feature request related to a problem? Please describe. Using
@namespace.marshal_with
multiple times on one method results in only the outer-mostmarhal_with
's model being used. The only workaround is to instead use@namespace.response
and explicitly callmarshal
within a mess of control flow statements.Describe the solution you'd like I would like to get rid of the many if-blocks and replace them with
marshal_with
decorators that can dispatch to the correct model based on status code.I don't think the current closure-based approach can be easily hacked to allow this. My first thought was to use a mapping of model names to
marshalling.marshal_with
instances, but I'm not sure how to change what the closure returns or how the handler then gets called. Second thought wassingledispatch
, but since that can't dispatch onLiteral
types as of Py38 you'd need a class for every HTTP status code... (or a class factory).