Commit 5979dd4
fix: wrap unresolvable $ref in ValidationError
When a $ref points to a nonexistent target, the referencing library's
Unresolvable (PointerToNowhere) exception escaped uncaught instead of being
wrapped in a ValidationError. This leaked the internal library exception
(and, as a side effect, dumped the entire spec into the error message).
Catch Unresolvable in SpecValidator.validate() and is_valid(), wrap in
jsonschema.exceptions.ValidationError. Updated existing test_ref_failed tests
to expect ValidationError (the documented behavior) instead of Unresolvable
(the leak). Fixes #511.
Assisted-by: Claude (Anthropic).
Co-Authored-By: claude-flow <ruv@ruv.net>1 parent 2121137 commit 5979dd4
2 files changed
Lines changed: 14 additions & 5 deletions
File tree
- openapi_spec_validator/validation
- tests/integration/validation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | | - | |
73 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
180 | | - | |
| 181 | + | |
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| |||
0 commit comments