marshmallow-code / marshmallow-code/marshmallow
[RFC] Add BigInt, SmallInt,... fields.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 738
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 7
Description
Originally in https://github.com/marshmallow-code/flask-smorest/pull/549.
One may add a range validator to every int field in their code base but that is cumbersome. Or subclass the Integer field to create a dedicated field, but it is a pity to do it in every code base if it can be done here.
Since this seems to be a common need, and the vocabulary seems to be shared across databases (https://www.postgresql.org/docs/current/datatype-numeric.html, https://learn.microsoft.com/fr-fr/sql/t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql), perhaps we could provide dedicated fields in marshmallow.
```
- BigInteger(Integer) -> Range(-2**63+1,2**63-1)
- SmallInteger(Integer) -> 2**8
```
I don't know how we'd call 2**32 Integer without breaking current Integer field.
Or we make this a parameter of Integer. But I think a dedicated class is nicer to use.
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 reviewing the existing Integer field and the requirements in the referenced flask-smorest PR. Resolve the proposed class names, numeric ranges, and whether this should be implemented as dedicated fields or an Integer parameter. Done means the API and range semantics have agreement before implementation begins.
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
- Needs clarification
- Newbie friendliness
- 25/100