marshmallow-code / marshmallow-code/marshmallow
Integer field won't accept boolean value when strict is False
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
As mentioned in the documentation, for `Integer` fields when the strict parameter is False any value that is castable to integer is acceptable:
> strict – If True, only integer types are valid. Otherwise, any value castable to int is valid.
But actually, if you pass True or False when strict is False the validation will fail although boolean values are castable to int:
```
assert int(True) == 1
assert int(False) == 0
```
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
Start by locating the Integer field's validation and strict=False handling in the marshmallow codebase. Reproduce the issue with True and False, then verify that boolean values follow the documented castable-to-integer behavior without changing strict=True validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100