go-jsonschema icon indicating copy to clipboard operation
go-jsonschema copied to clipboard

Add minimum and maximum validations

Open jmaeso opened this issue 5 years ago • 7 comments
trafficstars

jmaeso avatar Feb 08 '20 00:02 jmaeso

Still needed to test some edge cases like float precisions and integer validations. Too late today >.<

jmaeso avatar Feb 08 '20 00:02 jmaeso

There are two different things to note at that point: 1- Blocked since I can't print to the file the character % for the multipleOf validation 2- Found a bug on my PR itself where multiple number validations can't be applied at once

jmaeso avatar Feb 09 '20 02:02 jmaeso

Now there is just the issue with the % sign and spaces on its sides. Don't know how to solve it. cc/ @atombender

jmaeso avatar Feb 10 '20 10:02 jmaeso

@jmaeso I'm interested in merging this if you could maybe rebase it from master?

atombender avatar Feb 24 '21 16:02 atombender

I was testing after applying the rebase and got some issues. When reviewing the errors actually realized that master tests are not passing for me (suffix -Json is being added in all the generated structs and looks like it's not the expected behaviour). Since my code is like 1 year old now I would feel more confident if master gets fixed first in order to continue the rebase.

In case I am the only one experiencing the issue, I'm running go version go1.15.8 darwin/amd64

jmaeso avatar Mar 01 '21 17:03 jmaeso

Implementation updated @atombender . Actually looks like I didn't need the % operator... TIL % operator does not support floats: https://play.golang.org/p/H3yaNpKbJhu

ps: feel free to require a different implementation strategy

jmaeso avatar May 03 '21 18:05 jmaeso

Oh, incidentally I happened to hack on primitive validation too last night without noticing this, my approach is in #21 (only maximum/exclusiveMaximum done for now, but should be mostly trivial to add the rest). No personal preferences as to which approach to adopt as long as one is merged :) Will leave a few comments here.

scop avatar May 07 '21 05:05 scop

I am closing this PR as it's become stale, and we'll likely review the whole validation system in the future.

omissis avatar Nov 07 '23 23:11 omissis