marshmallow-code / marshmallow-code/marshmallow
Dump converts int or bool to float
Open
Nobody has claimed this yet.
polymorphism
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
I have an schema:
class ExampleSchema(Schema):
name: str
value: int | float | bool
When I pass an integer or boolean value, marshmallow converts it into a float. Is there any clean way to correct this?
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 reproducing the reported schema with the value: int | float | bool field and compare dump results for integer, boolean, and float inputs. Trace the schema's union handling to identify why integers and booleans become floats; done means those values retain their original types while float values still dump correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100