Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify local object definitions and recurse over the properties #186

Merged

Conversation

@lphuberdeau
Copy link
Contributor

commented Mar 15, 2018

This adds a little bit of consistency allowing object definitions as part of the response - not only arrays. My primary case for this is to wrap all of our responses in a data property without having to declare a custom schema for each data type individually.

@lafrech

This comment has been minimized.

Copy link
Member

commented Apr 1, 2018

IIUC, you're stepping into the object to identify properties using known schemas. If we go this route, why stop at the first level and not recurse through the whole schemas?

Also, it looks like your use case is similar to http://marshmallow.readthedocs.io/en/latest/extending.html#example-enveloping. I'm not sure how to use this pre_load/post_dump trick with apispec, though

@lphuberdeau

This comment has been minimized.

Copy link
Contributor Author

commented Apr 3, 2018

The patch does recurse through the entire structure of object definitions as the same function is called for each matching child entry.

@lafrech

This comment has been minimized.

Copy link
Member

commented Apr 3, 2018

Oh, right. Sorry.

I don't have any objection to this PR.

@sloria

This comment has been minimized.

Copy link
Member

commented Apr 5, 2018

Good change. Thanks @lphuberdeau!

@sloria sloria merged commit cfa627f into marshmallow-code:dev Apr 5, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.