Added capability to specify min/max bounds in OAS.#254
Added capability to specify min/max bounds in OAS.#254bombaywalla wants to merge 2 commits intooliyh:masterfrom
Conversation
|
Nice! One approach you could use would be to derive a function for each constraint (e.g. <, >) and then invert some-fn to compose them. That way you compile the minimal function at schema-read time, not at schema checking at request time. Doesn't the built in Int type ensure that you will get numbers by the time it hits your bounds function? Is the check that the value is a number redundant? Thanks |
I believe I am checking to see whether the values of |
Are you suggesting that, at schema-read time, I create a single bounds-checking function (say Would you please clarify what you mean by "invert some-fn to compose them"? |
Yes, exactly this. Ignore the some-fn comment, I was thinking about the composition of f but you can do it how you like. Thanks again for your contribution |
This makes the runtime check slightly faster, at the expense of slighly slower compile time. As per request by @oliyh.
fa11170 to
080c542
Compare
|
I updated this PR to handle the recent changes in master, so there are no conflicts. |
For a schema with a type of "integer" or "number", you can now specify any or all of the following additional optional assertions: minimum, maximum, exclusiveMinimum, exclusiveMaximum. As per OpenAPI 3.1.0.
With tests.
Addresses #229