Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions test/jsonschema/frame/draft2/requires_holding_a_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"schema": {
"$schema": "http://json-schema.org/draft-02/schema#",
"properties": {
"one": {
"requires": {
"type": "string"
}
}
}
},
"root": {
"mode": "root",
"locations": {
"static": {
"": {
"parent": null,
"type": "subschema",
"root": null,
"base": "",
"pointer": "",
"relativePointer": "",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
}
},
"dynamic": {}
},
"references": []
},
"pointers": {
"mode": "pointers",
"locations": {
"static": {
"": {
"parent": null,
"type": "subschema",
"root": null,
"base": "",
"pointer": "",
"relativePointer": "",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
},
"#/$schema": {
"parent": "",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/$schema",
"relativePointer": "/$schema",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
},
"#/properties": {
"parent": "",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/properties",
"relativePointer": "/properties",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
},
"#/properties/one": {
"parent": "",
"type": "subschema",
"root": null,
"base": "",
"pointer": "/properties/one",
"relativePointer": "/properties/one",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
},
"#/properties/one/requires": {
"parent": "/properties/one",
"type": "subschema",
"root": null,
"base": "",
"pointer": "/properties/one/requires",
"relativePointer": "/properties/one/requires",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
},
"#/properties/one/requires/type": {
"parent": "/properties/one/requires",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/properties/one/requires/type",
"relativePointer": "/properties/one/requires/type",
"dialect": "http://json-schema.org/draft-02/schema#",
"baseDialect": "http://json-schema.org/draft-02/hyper-schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-02/schema#": true
}
}
},
"dynamic": {}
},
"references": [
{
"type": "static",
"origin": "/$schema",
"original": "http://json-schema.org/draft-02/schema#",
"destination": "http://json-schema.org/draft-02/schema",
"base": "http://json-schema.org/draft-02/schema",
"fragment": null
}
]
},
"standalone": true
}
158 changes: 158 additions & 0 deletions test/jsonschema/frame/draft3/disallow_holding_a_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"schema": {
"$schema": "http://json-schema.org/draft-03/schema#",
"disallow": [
{
"type": "string"
},
"null"
]
},
"root": {
"mode": "root",
"locations": {
"static": {
"": {
"parent": null,
"type": "subschema",
"root": null,
"base": "",
"pointer": "",
"relativePointer": "",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
}
},
"dynamic": {}
},
"references": []
},
"pointers": {
"mode": "pointers",
"locations": {
"static": {
"": {
"parent": null,
"type": "subschema",
"root": null,
"base": "",
"pointer": "",
"relativePointer": "",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
},
"#/$schema": {
"parent": "",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/$schema",
"relativePointer": "/$schema",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
},
"#/disallow": {
"parent": "",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/disallow",
"relativePointer": "/disallow",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
},
"#/disallow/0": {
"parent": "",
"type": "subschema",
"root": null,
"base": "",
"pointer": "/disallow/0",
"relativePointer": "/disallow/0",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
},
"#/disallow/0/type": {
"parent": "/disallow/0",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/disallow/0/type",
"relativePointer": "/disallow/0/type",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
},
"#/disallow/1": {
"parent": "",
"type": "pointer",
"root": null,
"base": "",
"pointer": "/disallow/1",
"relativePointer": "/disallow/1",
"dialect": "http://json-schema.org/draft-03/schema#",
"baseDialect": "http://json-schema.org/draft-03/schema#",
"propertyName": false,
"orphan": false,
"hasReferencesTo": false,
"hasReferencesThrough": false,
"vocabularies": {
"http://json-schema.org/draft-03/schema#": true
}
}
},
"dynamic": {}
},
"references": [
{
"type": "static",
"origin": "/$schema",
"original": "http://json-schema.org/draft-03/schema#",
"destination": "http://json-schema.org/draft-03/schema",
"base": "http://json-schema.org/draft-03/schema",
"fragment": null
}
]
},
"standalone": true
}
23 changes: 23 additions & 0 deletions test/jsonschema/jsonschema_frame_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2639,3 +2639,26 @@ TEST(draft7_root_id_fragment_invalid_leading_digit_root_mode) {
FAIL();
}
}

TEST(identifier_that_is_not_a_valid_uri) {
const sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema",
"$defs": {
"inner": { "$id": "//[::44.1" }
}
})JSON");

try {
[[maybe_unused]] const sourcemeta::core::SchemaFrame frame{
sourcemeta::core::SchemaFrame::Mode::References, document,
sourcemeta::core::schema_walker, sourcemeta::core::schema_resolver};
FAIL();
} catch (const sourcemeta::core::SchemaKeywordError &error) {
EXPECT_STREQ(error.what(), "The identifier is not a valid URI");
EXPECT_EQ(error.keyword(), "$id");
EXPECT_EQ(error.value(), "//[::44.1");
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
} catch (...) {
FAIL();
}
}
Loading