-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pattern, support reference constraints on primitives, and add number/integer constraints #264
Conversation
Hey @nolag , thanks for putting out this PR! Can you give me a heads up when it's ready (I see you're still pushing on it) so I can review it? :) |
It's ready, I don't have more work planned. Each commit I made was meant to be independent, I figured I could open one PR and you could review it by commit if you wanted, but at this point, a squash probably makes more sense. I can make a final commit tomorrow to resolve the merge conflict. I'm not sure why, but goland insisted on some of those changes and it wouldn't work without them. |
sweet! can you just fix the conflict in the go.mod? I'll look at it soon as I can! |
I realized I have one more commit locally that I need to clean up. I'll also fix the go mod issue. Still aiming for today. |
6a308d7
to
ec60cd3
Compare
@omissis FYI, should be good to go soon, I can't reproduce the generation error locally though... I'll spend a bit of time to debug it, but if you can reproduce that would be helpful... I think it has to do with the casting floats to ints, I should probably use some epsilon or a better way like math.Round. I'll give that a try and ping you if I still need help Sorry for all the force pushes at the end, I had some trouble getting the linter running locally for the tests (even with upstream/main). I did find another bug that I didn't fix. Arrays don't apply rules for their elements. Ie: String's length in an array and now patterns and number bounds aren't checked. I'll need to fix that eventually (or have it fixed) but it'll be a new PR at this point (it's not blocking our use case right now). |
@omissis was able to get it consistently passing locally and on CI now. PR is good to go. For context, the min int size is so that we can use binary data as a uint8, which we need. It's a flagged feature so it won't change any existing users :). It also allows more efficient checks when the number is bound by a set size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive PR! besides a couple nitpicks, I am just not sure about the exclusive minimum and maximum: I see they support two implementations, one with numeric exclusive min/max, and one with boolean + an extra value.
From what I see on jsonschema, the numeric one should be the correct one since draft-07, so I take you implemented both for BC reasons? in that case the boolean one should be the one that has the "Old" suffix, right? I'm referring to tests/data/validation/exclusiveMaximum/exclusiveMaximumOld.[json|go]
Thanks!
Thanks for reviewing, and good catch on my mix-up with the exclusive min/max. |
No description provided.