marshmallow-code / marshmallow-code/marshmallow

Add a field type that behaves like oneOfType in React proptypes

Open
#1,621 1 comment 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.