marshmallow-code / marshmallow-code/marshmallow
Add a field type that behaves like oneOfType in React proptypes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
I have a field for a filter than can take either a bool or an array of strings. So I would like to be able to do something like this in my webargs schema:
```python
@use_kwargs({
'filters': fields.OneOfType(
fields.Bool,
fields.List(fields.String()),
)
})
```
I don't think this is possible right now without implementing a custom field type...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the requested webargs schema usage and compare the existing fields.Bool, fields.List, and fields.String behavior. Determine the intended OneOfType API and validation semantics; done means a schema can accept either a boolean or an array of strings without a custom field type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100