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

Add support of marshmallow schema instance as nested parameter. #39

Closed
AndreyKis opened this issue Oct 10, 2019 · 2 comments · Fixed by #40
Closed

Add support of marshmallow schema instance as nested parameter. #39

AndreyKis opened this issue Oct 10, 2019 · 2 comments · Fixed by #40
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@AndreyKis
Copy link
Contributor

AndreyKis commented Oct 10, 2019

As seen from this answer, marshmallow supports usage of schema instance as nested field of outer schema.

Question in that StackOverflow thread contains one of the examples, when this could be useful and exact use-case we have in our project.

Unfortunately, flask_accepts doesn't support such behaviour at the moment. Usage of schema instance results in Error, thrown in flask_accepts/utils.py at this line of code:
Screen Shot 2019-10-10 at 13 34 35

I could submit a fix for that by the end of today. The only change added will be this one:
Screen Shot 2019-10-10 at 13 50 56

Note: In the future this could be improved to iteration over type_map keys and ensuring isinstance for all of them.
This would make available usage of marshmallow feature to extend existing marshmallow fields

@apryor6 apryor6 added enhancement New feature or request help wanted Extra attention is needed labels Oct 10, 2019
@apryor6
Copy link
Owner

apryor6 commented Oct 10, 2019

👍 this would be a good feature. Open a PR w/ relevant tests and I'm happy to accept

@AndreyKis
Copy link
Contributor Author

Great, will do, thank you

AndreyKis pushed a commit to AndreyKis/flask_accepts that referenced this issue Oct 11, 2019
apryor6 added a commit that referenced this issue Oct 11, 2019
Issue #39 resolved. Added support for ma schema instances as nested field in outer schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
2 participants