-
-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Catching RefResolutionError no longer works #1069
Comments
I considered this at one point (and decided against it only when I realized how non-trivial it is to do this). I can revisit and try again now that things are slightly more finished, though my rationalization as I was playing with this is that in general in my experience it's not really considered a backwards incompatible change to raise new exceptions from an existing code block, especially when recovering from the exception isn't really feasible anyhow like in this case -- i.e. I don't think it'd be unreasonable if So yeah willing to be convinced I suppose, I can certainly see an argument for this -- or certainly to review a PR, and possibly will have another look myself after resolving the more "pressing" alpha issues like #1065. But it's not 100% clear to me yet that this is a necessary thing to preserve, so I don't suspect it'll block the release if everything else is resolved and it turns out it's indeed annoying to do this. |
FWIW, I (https://github.com/devicetree-org/dt-schema) also depend on and raise RefResolutionError exceptions in my custom handler. However, things currently appear to be broken beyond that, so I'll probably just pin things at <4.18 until I move to the new API. The bigger issue seems to be schema1 ref to schema2 to local (schema2) ref breaks on the local ref. I haven't debugged it further. |
Happy to have a look if you can share more details. The original ticket here I certainly understood to be about catching
I can't visualize this (and whether it has to do with the above) -- it sounds like it doesn't though -- and that this might be something separate? An actual chain of references that you have that's now broken? |
Oh I see, you're talking about in a handler for |
Yes, that's where I raise them. I also catch them, so I think it is related. Perhaps with my custom RefResolver, I'm the only source. Not really sure. If the exception type is changing, I think that will need an update on my side and 4.18 won't just work. |
That should only be the case if you're not using (All the internal |
This actually may not have been so difficult in the end. The referenced commit will go out in another alpha (a4) in a few minutes. Try it out, and let me know if it doesn't fix whatever existing code you had that was assuming a |
(Obviously as I say it's still advisable to move to catching |
With 4.18, reference resolution errors become
referencing.exceptions.Unresolvable
, so existing code which catchesjsonschema.exceptions.RefResolutionError
would no longer handle them.Might want to consider wrapping them at the "jsonschema boundary", since it's a bit of a breaking change for a minor version.
Notably
RefResolutionError
is raised even in naive cases when a user never passes in aRefResolver
(that's been deprecated) knowingly, so there's no warning to the user that will make them reckon with the deprecation.The text was updated successfully, but these errors were encountered: