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

Allow to define required fields in schema constructor and meta #1670

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

mgetka
Copy link
Contributor

@mgetka mgetka commented Sep 25, 2020

Working with marshmallow I appreciated, that I can define load_only and dump_only fields via schema constructor and Meta. Also, I missed a feature that would allow to define required fields in similar way. This PR adds such functionality.

@mgetka
Copy link
Contributor Author

mgetka commented Nov 13, 2020

Ok, so I can see that the topic is pretty controversial. My insights stem from discussion in the following issues: #466, #344, #453. @lafrech commented in one of those issues that v3 could be a good moment to deprecate load_only, and dump_only meta options. At the moment, we are deep into v3 line and the depreciation did not happened.

Personally, I have found load_only and dump_only meta/constructor options extremely useful, and I am not working on any kind of automated schema creation tool. I'm using it to create specialized loader/dumper objects in which fields become dump_only or load_only based on authorization context. I would also like to mark some fields required in similar manner.

I would be grateful to receive some feedback on this topic. If dump_only and load_only meta/constructor options are still considered technical debt since 2017, maybe some actions on theirs depreciation could be made. For me it would be a clear signal no to utilize them in my projects. On the other hand, if those options are now considered a legitimate part of the API, including of required, as well as allow_none, could be considered.

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.

1 participant