jmcarp / jmcarp/flask-apispec

Support for @use_args with flask-apispec

Open
#189 0 comments 8 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
652
Forks
151
PR merge metrics
No merged PRs in 30d

Description

Hi All,

I have been using flask-apispec for creating swagger documentation for my applications, so far, I feel everything has worked well for me except for one thing.

webargs library support @use_args annotation which is currently not supported in here. Primary reason why this annotation is helpful is because of this :

https://webargs.readthedocs.io/en/latest/advanced.html

"Any Schema passed to use_kwargs MUST deserialize to a dictionary of data. If your schema has a post_load method that returns a non-dictionary, you should use use_args instead."

I would want to be able to deserialize the composite request objects (where an object contains other classes as attributes) into class entities without having to write deserializing code for it. @post_load method with marshmallow allows me to do it easily but because it is not supported on @use_kwargs and flask-apispec, I have to write the mappers for those into class objects.

It would be great if someone can help me figure out easy way to convert those kwargs into class objects as an alternative or if use of @use_args can be supported for parsing request objects in flask-apispec.

Thank you.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading flask-apispec's handling of @use_kwargs and the webargs advanced documentation for @use_args. Done means flask-apispec supports schemas whose @post_load result is a non-dictionary, allowing composite request objects to deserialize into class entities without custom mappers; cover the behavior with an integration test.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.