Skip to content
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

Schema fails to compile when id doesn't end with # and there are self-references #215

Open
cmrd-senya opened this issue Jul 11, 2018 · 0 comments

Comments

@cmrd-senya
Copy link

The following schema is valid:

{
    "id": "http://my.site/myschema",
    "$ref": "#/definitions/schema2",
    "definitions": {
        "schema1": {
            "id": "schema1",
            "type": "integer"
        },
        "schema2": {
            "type": "array",
            "items": {
                "$ref": "schema1"
            }
        }
    }
}

But when it passed to z-schema it fails to compile. The same schema with the id equal to http://my.site/myschema# works.

It is easy to verify by changing the existing test in the z-schema testsuite:

diff --git a/test/ZSchemaTestSuite/Issue12.js b/test/ZSchemaTestSuite/Issue12.js
index 1ba4ed6..f76540a 100644
--- a/test/ZSchemaTestSuite/Issue12.js
+++ b/test/ZSchemaTestSuite/Issue12.js
@@ -6,7 +6,7 @@ module.exports = {
         {
             description: "should pass validation",
             schema: {
-                "id": "http://my.site/myschema#",
+                "id": "http://my.site/myschema",
                 "$ref": "#/definitions/schema2",
                 "definitions": {
                     "schema1": {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants