-
Notifications
You must be signed in to change notification settings - Fork 44
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
Error messages do not include context to locate problematic parts in schema #69
Comments
It's very hard to provide context on every error not raised in your own code. Sorry about that. That said, in this case I can easily provide some context. Looks like some URL you're using to refer to some object isn't parseable by urllib - which may mean it's invalid. That is simple enough to catch and provide context on. Thanks for reporting this! |
…-urlparse-errors Test case and fix for #69
Fixed in 0.18.3 |
Hi, the error message now is:
which is an improvement for sure but maybe even more context would be possible? Maybe the name of the definition? In my case |
Oh for sure. It's just not very easy to get at at the point that the error is raised. I've been thinking about how to improve that.
In the meantime, your stack trace suggests that it's a `$ref` key that is mistakenly a dict. Since that's always wrong, even if you have 5k instances of it, you've got something to look for. Hopefully it only appears once!
…On 1 Jun 2020, 11:08, at 11:08, Florian Ludwig ***@***.***> wrote:
Hi,
the error message now is:
```
ERROR in "v1.16.4.json" [ResolutionError]: 'dict' object has no
attribute 'decode' -- Unable to parse url: {'type': 'string'}
```
which is an improvement for sure but maybe even more context would be
possible? Maybe the name of the definition?
In my case `"type": "string"` is 5139 times in the json.
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#69 (comment)
|
Thanks for the hint, did help to find it! |
Actually, I believe the schema is correct. It defines a property called
Reading the specification I am not actually 100% sure if this is allowed or not. |
Well, consider `$ref` a reserved key if you have JSON references. I don't think that's possible. There may be a way to e.g. escape the `$` sign to make it legal.
…On 1 Jun 2020, 12:17, at 12:17, Florian Ludwig ***@***.***> wrote:
Actually, I believe the schema is correct.
It defines a property called `$ref` which is a string. Basically
defining JSONSchema in JSONSchema:
```
"io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps":
{
"description": "JSONSchemaProps is a JSON-Schema following
Specification Draft 4 (http://json-schema.org/).",
"properties": {
"$ref": {
"type": "string"
},
```
Reading the specification I am not actually sure if this is correct or
not.
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#69 (comment)
|
-- https://swagger.io/docs/specification/using-ref/ So I guess it is not that simple that all |
There's that. But OpenAPI is a conflicting spec. They also claim to be using JSON schema and JSON references, but violate those specs in places. So OpenAPI implementations vary (hence the multiple backends, even if some of them are barely active). Most are based on JSON schema validators, because that's the easy way to implement things. Technically, those don't conform to OpenAPI precisely. You only notice it in these instances, though. The TL;DR is, with conflicting specs, it's IMHO best to stick to the (very large) subset of things that are unambiguous. Treating |
https://github.com/jfinkhaeuser/prance#a-note-on-json-references for some context. |
And in the README, also maybe see the less relevant note on strict mode. |
And I figured I'd update the list and move it out of the README so the README doesn't become so cluttered. https://github.com/jfinkhaeuser/prance/blob/master/COMPATIBILITY.rst |
Thank you for the clarifications! I probably have to read more of the specs to understand those edge cases. |
Expected Behaviour
Providing some context which part of my 113k line file failed.
Actual Behaviour
Steps to Reproduce
Environment
@jfinkhaeuser
The text was updated successfully, but these errors were encountered: