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
{{ message }}
This repository was archived by the owner on Jun 6, 2024. It is now read-only.
The envelope used to serialize responses is implemented in a set of helper methods (format_items, wrap_response, etc.) that could be challenging to introspect (e.g. for building swagger docs). Implementing the envelope using fields and nested schemas would be more amenable to introspection--it should Just Work with apispec.
One option would be adding some magic to Schema--for example, overriding get_declared_fields to replace the original fields with attributes, a Nested that wraps the original fields. This might be too opaque, so we could also define primary schemas separately and explicitly wrap them in JsonSchema classes.
Or maybe this complicates the implementation too much, and it's best to sacrifice purity and just introspect schemas manually--it shouldn't be too hard to write an apispec hook that generates the appropriate markup. The only other caveat there would be that introspection would be brittle, and likely stop working if users subclass Schema and change the envelopes.
The envelope used to serialize responses is implemented in a set of helper methods (
format_items,wrap_response, etc.) that could be challenging to introspect (e.g. for building swagger docs). Implementing the envelope using fields and nested schemas would be more amenable to introspection--it should Just Work with apispec.One option would be adding some magic to
Schema--for example, overridingget_declared_fieldsto replace the original fields withattributes, aNestedthat wraps the original fields. This might be too opaque, so we could also define primary schemas separately and explicitly wrap them inJsonSchemaclasses.Or maybe this complicates the implementation too much, and it's best to sacrifice purity and just introspect schemas manually--it shouldn't be too hard to write an apispec hook that generates the appropriate markup. The only other caveat there would be that introspection would be brittle, and likely stop working if users subclass
Schemaand change the envelopes.Help @sloria!