-
-
Notifications
You must be signed in to change notification settings - Fork 578
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
PR for Issue 728 #738
PR for Issue 728 #738
Conversation
Codecov Report
@@ Coverage Diff @@
## master #738 +/- ##
==========================================
+ Coverage 96.02% 96.06% +0.03%
==========================================
Files 17 17
Lines 2664 2716 +52
Branches 310 323 +13
==========================================
+ Hits 2558 2609 +51
Misses 87 87
- Partials 19 20 +1
Continue to review full report at Codecov.
|
Thanks for giving this a shot it's super appreciated! I haven't gotten a chance to think about this carefully, but two quick thoughts -- First, it's probably good if we start by adding the test cases we'll care about improving. There are a few I know in that issue ticket. Second -- I don't want to be hardcoding types (which type a validator cares about) especially since that'll be very brittle in the face of either And again really appreciate you taking a crack at this given it'd be unlikely I get to it otherwise. |
…ize the type of the error of the instance
…he same type of the instance for const
…he same type of the instance for enum
Hey, On using the
And, in the second instance I don't know how I'm quite new to the code there, so maybe I've made a mistake and not looked into the right property of Regarding the Thanks for your help, and looking forward to your advice. |
Amazing, will have a look, appreciated!
I think schemas without It's true that there are even trickier things that can be done, but they're a lot more difficult, especially to design an interface that works in these additional scenarios where someone has customized what type (Which yes is exactly what I'll have a closer look at this but yeah hopefully if we limit scope for a first PR it makes things significantly easier? |
for. Modifying the system to lookup the 'type' property of the rule to match the type of the instance.
Hi, I still think that using a map between the validator and which type of object it's validating would achieve more consistent results, for when type isn't provided. But this would mean refactoring all the _validators.py checks like those :
To something like,
And then using ACCEPTED_TYPE to find what type is the error, and see if it is the same type as the instance. Still a bit of an ugly implementation, but maybe good to dissociate the type check from the validator. Something to keep in mind for the future maybe. Let me know what you think, and if you think the |
This is an example on how to to enhance best_match function, to prioritize issues of same type. I'm not sure where the code should go, and how it should be separated between the different files. This simply is an easy way to fix the problem, and I expect you'll be able to suggest how best to include this in the overall architecture of your project.
Definitions of non draft-07 validation types have not been included here, since I expect there are things that can be improved before with this PR.
What do you think.