marshmallow-code / marshmallow-code/marshmallow
Always set data_key
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
Hello all,
in my application we use and love marshmallow. We have a lot of dynamic coding, therefore we access fields e.g. over the `declared_fields` attribute. Also we need most of the time the `Field.data_key` attribute which is defined as `str | None`.
I would like to suggest an option, which always sets the data_key so that it will never be None. If the user provides it, fine. Else, just set it to the field name. I guess this could also simplify some coding, since you can expect that this attribute is always set.
What do you think?
Contributor guide
Research direction
Start by reading the Field.data_key definition and checking how fields are exposed through declared_fields. Determine the expected behavior when a field name is used without an explicit data_key, then inspect the existing field tests to identify where this option and its compatibility should be covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100