flask-openapi3 icon indicating copy to clipboard operation
flask-openapi3 copied to clipboard

[Feature Request] Add support for separate input/output schemas

Open dotsbb opened this issue 11 months ago • 2 comments

New Feature - add an ability to maintain separate schemas for request and response models, similar to FastAPI's implementation.

Current Behavior

Currently, parse_parameters overwrites component schemas (APIView.components_schemas) that were previously extracted by get_responses. Usually get_responses returns different schemas due tomode="serialization" and we're loosing any additional information (such as @computed_fields)

Proposed Solution

I could add a new configuration option separate_input_output_schemas:

  • Defaults to false to maintain backward compatibility
  • When enabled, maintains distinct schemas for:
    • Request bodies and parameters -Input suffix
    • Response models -Output suffix

dotsbb avatar Dec 20 '24 14:12 dotsbb

@luolingchun What are your thoughts on this? If you feel this feature would be valuable, I can begin implementation next week. Please share any context or feedback that would help inform the work.

dotsbb avatar Dec 20 '24 16:12 dotsbb

Good idea, thank you in advance for the work you did on this.

luolingchun avatar Dec 21 '24 07:12 luolingchun