Skip to content

"id" attribute in root schema requires unnecessary on-line access (if present) #102

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

Closed
jenisys opened this issue May 11, 2013 · 4 comments · Fixed by #103
Closed

"id" attribute in root schema requires unnecessary on-line access (if present) #102

jenisys opened this issue May 11, 2013 · 4 comments · Fixed by #103

Comments

@jenisys
Copy link

jenisys commented May 11, 2013

VERSION: jsonschema-1.3.0

If an ID attribute is present in at the root in a schema, the validator tries to retrieve the referenced ID value which causes problems in off-line mode.
AFAIK this ID attribute servers only as identifier for others. Therefore, there is no need to retrieve it (at least not for the described case).

EXAMPLE:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "https://raw.github.com./xxx/zzz/master/etc/json/my.json-schema#",
    ...
}

When I validate it (in off-line mode), I get the following error:

RefResolutionError: HTTPSConnectionPool(host='raw.github.com.', port=443): Max retries exceeded with url: /xxx/zzz/master/etc/json/my.json-schema

After removal of the id attribute, everything is OK.
Is the ID usage wrong or does jsonschema have a problem?

@gazpachoking
Copy link
Contributor

What do your $refs look like?

@gazpachoking
Copy link
Contributor

Ahh, actually I think I know the problem already. Let me see if I can replicate it in a test.

@gazpachoking
Copy link
Contributor

@jenisys I think this should do it, let us know if not, and give some more details on what your $refs are like.

@jenisys
Copy link
Author

jenisys commented May 12, 2013

@gazpachoking
Thx for the quick response.
I checkout your changes in the next few days.

To your first question regarding the $refs:
I am currently using only internal references to definitions.
If you interested my JSON schema is checked-in here (without the "id" attribute).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants