-
Notifications
You must be signed in to change notification settings - Fork 58
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
Stop subclassing JSONSchema validator #1185
Stop subclassing JSONSchema validator #1185
Conversation
@Julian this is my initial attempt to stop subclassing Please feel free to leave comments, alternate suggestions, or a review. I would welcome your thoughts. |
I believe the failing tests are due to a bug in |
Hi! Monkeypatching an object you don't "own" (i.e. a validator class) is definitely even more fragile than subclassing from it, so this definitely could be improved somehow. I'll have to spend some time with it to see what to recommend though, unless someone else sees it first. |
@Julian I completely agree that Monkeypatching is less than ideal. Essentially, I am just "replicating" the changes the previous subclassing would have accomplished. This "avoids" the warning that has been added as that breaks the required testing in downstream packages that rely on asdf (they turn all warnings into raised errors); moreover, the warning does mention that subclassing will be removed at a later date. The alternate method to this is to start with what you suggested in python-jsonschema/jsonschema#981 (comment); however, as far as I can tell this then requires me to then replicate much of the jsonschema As far as I can tell there isn't an interface provided by jsonschema which is rich enough to enable asdf to add its additional logic on top of the jsonschema |
Tagging @eslavich to weigh in, as they understand how asdf leverages jsonschema better than I do. |
I agree that we won't be able to support descending into tag schemas by composing jsonschema's validator or modifying the evolve-able attributes. Should asdf simply vendorize jsonschema at a version that works for us? Our use case is bizarre and I don't think it's reasonable to expect jsonschema to officially support the level of customization that we need. Since we're stuck on draft 4 anyway, we won't miss the new features, and that draft is nearly a decade old so I don't expect that there will be much to maintain. |
If there's any detail you can share about what's missing that'd definitely be useful to hear, though I still haven't dug in in detail yet, apologies. |
Currently the Lines 266 to 311 in ebac36e
It provides two functions:
The remaining components of the The main point is that asdf has to do some work to handle yaml/asdf specific things outside the scope of the original |
e96bf2d
to
3bd3a38
Compare
3bd3a38
to
8feecb5
Compare
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.
Looks good to me.
https://build.opensuse.org/request/show/1030520 by user bnavigator + dimstar_suse - Update to 2.13.0 * The ASDF Standard is at v1.6.0 * Add ability to pull information from schema about asdf file data, using ~asdf.AsdfFile.schema_info method. [#1167] - Release 2.12.1 * Overhaul of the ASDF documentation to make it more consistent and readable. [#1142, #1152] * Update deprecated instances of abstractproperty to abstractmethod [#1148] * Move build configuration into pyproject.toml [#1149, #1155] * Pin jsonschema to below 4.10.0. [#1171] - Release 2.12.0 * Added ability to display title as a comment in using the info() functionality. [#1138] * Add ability to set asdf-standard version for schema example items. [#1143] - Add asdf-pr1185+pr1203-fix-jsonschema.patch * gh#asdf-format/asdf#1185, gh#asdf-format/asdf#1203 - Add asdf-pr1214-inst
Potentential fix for issue #1172