Skip to content

Adds support for marshmallow @post_load - #119

Merged
sloria merged 2 commits into
jmcarp:masterfrom
elatomo:fix-103-use-kwargs-and-post-load
Jun 22, 2019
Merged

Adds support for marshmallow @post_load#119
sloria merged 2 commits into
jmcarp:masterfrom
elatomo:fix-103-use-kwargs-and-post-load

Conversation

@elatomo

@elatomo elatomo commented Sep 24, 2018

Copy link
Copy Markdown
Contributor

Fixes #103

Marshmallow @post_load decorator can be used as an object factory, to directly return an instance instead of the usual dictionary.

This PR adds support for it, based on #104 plus tests.

Marshmallow `@post_load` decorator can be used as a factory object, to directly
return an instance instead of the usual dictionary.

This commit adds support for it.
@codecov-io

codecov-io commented Sep 24, 2018

Copy link
Copy Markdown

Codecov Report

Merging #119 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
+ Coverage   97.64%   97.65%   +0.01%     
==========================================
  Files           8        8              
  Lines         339      341       +2     
==========================================
+ Hits          331      333       +2     
  Misses          8        8
Impacted Files Coverage Δ
flask_apispec/wrapper.py 98.11% <100%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 535fc9d...6ec36d3. Read the comment docs.

@tyarkoni

tyarkoni commented May 4, 2019

Copy link
Copy Markdown

Any chance this could be merged? It looks like a pretty common problem...

@marcus-oscarsson

Copy link
Copy Markdown

@jmcarp agree with @tyarkoni this seems like a common problem, what do you think about it ?

@rshah88

rshah88 commented May 22, 2019

Copy link
Copy Markdown

Can this be merged ? we are also hitting this.

@heckad

heckad commented Jun 17, 2019

Copy link
Copy Markdown

When it will be merged?

@rshah88

rshah88 commented Jun 17, 2019

Copy link
Copy Markdown

@sloria @jmcarp Can you guys help merge this ??

@sloria

sloria commented Jun 18, 2019

Copy link
Copy Markdown
Collaborator

Sorry for the delay on this. I can take a look and release this over the weekend.

@marcus-oscarsson

Copy link
Copy Markdown

@sloria Thanks !

Comment thread flask_apispec/wrapper.py Outdated
if getattr(schema, 'many', False):
args += tuple(parsed)
else:
elif getattr(parsed, 'update', False):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is risk of a false-positive here, e.g. model objects with an update method, so I think type-checking is preferable to duck-typing in this case.

I'll make this change myself.

@sloria
sloria merged commit 98fdf21 into jmcarp:master Jun 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when using use_kwargs with a schema which has @post_load

7 participants