-
Notifications
You must be signed in to change notification settings - Fork 54
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
atdgen: update abstract
type validation to accept all input by default
#301
Conversation
Hi! Personally, I haven't done much with validators in a while, so it's not something that was on my mind when I recently extended what we can do with |
After looking at the tests we have, it looks indeed that we have nothing for testing the validation of |
Thanks for the pointers on the tests. I will work on extending the existing abstract test for validations (and/or add more if there are use cases that aren't covered -- I agree with focusing test files). Here are some focused examples that don't work as expected (in fact, don't compile) with the current Untyped json without validator
This PR output. Validation is now an always-pass validation (which is what
Untyped json with validator
This PR output. Uses defined validator without a fallback.
I think this is pointing in a good direction, but it's totally possible I'm missing something! I'll post more if I run into anything while adding tests, too. |
92846ef
to
73b4c70
Compare
@mjambon just pushed added/updated tests. If you think it would be good to have tests for the validators (like in my examples), let me know. I'm happy to add that as well. |
The tests you added are sufficient, I think. Thank you! I'll let you update the changelog. |
73b4c70
to
786c7e2
Compare
abstract
type validation to accept all input by default
@mjambon changelog updated (and title of PR :) |
Thank you! Merging and starting a release. |
…n-codec-runtime and atd (2.9.0) CHANGES: * atdgen: update `abstract` type validation to accept all input by default (ahrefs/atd#301) * atdts: fix reader for case type (ahrefs/atd#302)
…n-codec-runtime and atd (2.9.0) CHANGES: * atdgen: update `abstract` type validation to accept all input by default (ahrefs/atd#301) * atdts: fix reader for case type (ahrefs/atd#302)
…n-codec-runtime and atd (2.9.1) CHANGES: * atdgen: update `abstract` type validation to accept all input by default (ahrefs/atd#301) * atdts: fix reader for case type (ahrefs/atd#302)
This PR follows up on #295 and #263 by making the default validation for
abstract
types pass for any input, while still allowing for custom validation.I used the following definition for testing, which appears to my eyes to be correct and compiles successfully (with a small
util.ml
with always-pass validation definitions).Feedback very much welcome since this is my first time in this code base!
PR checklist
CHANGES.md
is up-to-date