Replies: 1 comment 2 replies
-
|
@hosni cool! Feel free to submit a PR |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @romalytvynenko
After v0.13.0, Scramble supports ranged integer types via
IntegerRangeType.It would be great to use this new type for pagination-related schemas to make their definitions more accurate.
Currently, pagination fields like
per_page,current_page,from,to,last_page, andtotalare defined as plainIntegerType.Some of these fields can be
null(and Scramble already handles that correctly), but their numeric ranges are not currently constrained.Proposal
Use
IntegerRangeTypeto define the lower bounds for these pagination fields:per_pagenew IntegerRangeType(min: 0)current_pagenew IntegerRangeType(min: 1)fromnew IntegerRangeType(min: 1)tonew IntegerRangeType(min: 1)last_pagenew IntegerRangeType(min: 1)totalnew IntegerRangeType(min: 0)(Fields like
fromandtocan still be nullable, this suggestion only concerns their non-null range.)Why
IntegerRangeTypeintroduced in PR #996.This would make the generated API documentation both stricter and semantically correct.
Beta Was this translation helpful? Give feedback.
All reactions