typst-community / valkyrie

Type safe type safety for Typst
Other
25 stars 2 forks source link

Add back `min` and `max` schema parameters #10

Closed tingerrr closed 1 month ago

tingerrr commented 1 month ago

Previously the number, integer, float, string, and array schemas had the parameters min and max.

I propose adding these back, those range checks are fairly convenient, especially combined with z.<schema>.with(min: ...) for schema adaption. The main downside of not having them now is that nested schema validation cannot perform easy length checks.

JamesxX commented 1 month ago

As mentioned on discord, definitely agree. The last version where it existed was here: https://github.com/typst-community/valkyrie/blob/efd9a08e01a8763fb54386242d3fedcb9ec27586/src/types/array.typ#L61-L83

I'll make a branch and see about bringing this sort of way of handling it back