@@ -54,11 +54,11 @@ TEST(JSONSchema_wrap, schema_without_identifier) {
54
54
55
55
const auto expected{sourcemeta::core::parse_json (R"JSON( {
56
56
"$schema": "https://json-schema.org/draft/2020-12/schema",
57
- "$ref": "tag: core.sourcemeta.com,2025:wrap #/items",
57
+ "$ref": "__sourcemeta- core-wrap__ #/items",
58
58
"$defs": {
59
59
"schema": {
60
60
"$schema": "https://json-schema.org/draft/2020-12/schema",
61
- "$id": "tag: core.sourcemeta.com,2025:wrap ",
61
+ "$id": "__sourcemeta- core-wrap__ ",
62
62
"items": {
63
63
"type": "string"
64
64
}
@@ -69,6 +69,36 @@ TEST(JSONSchema_wrap, schema_without_identifier) {
69
69
EXPECT_EQ (result, expected);
70
70
}
71
71
72
+ TEST (JSONSchema_wrap, schema_without_identifier_and_relative_uri) {
73
+ const auto schema{sourcemeta::core::parse_json (R"JSON( {
74
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
75
+ "items": {
76
+ "$ref": "relative"
77
+ }
78
+ })JSON" )};
79
+
80
+ const auto result{sourcemeta::core::wrap (
81
+ schema, {" items" }, sourcemeta::core::schema_official_resolver)};
82
+
83
+ // We don't want the relative reference to be resolved against
84
+ // an absolute base
85
+ const auto expected{sourcemeta::core::parse_json (R"JSON( {
86
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
87
+ "$ref": "__sourcemeta-core-wrap__#/items",
88
+ "$defs": {
89
+ "schema": {
90
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
91
+ "$id": "__sourcemeta-core-wrap__",
92
+ "items": {
93
+ "$ref": "relative"
94
+ }
95
+ }
96
+ }
97
+ })JSON" )};
98
+
99
+ EXPECT_EQ (result, expected);
100
+ }
101
+
72
102
TEST (JSONSchema_wrap, schema_without_identifier_with_default_dialect) {
73
103
const auto schema{sourcemeta::core::parse_json (R"JSON( {
74
104
"items": {
@@ -82,11 +112,11 @@ TEST(JSONSchema_wrap, schema_without_identifier_with_default_dialect) {
82
112
83
113
const auto expected{sourcemeta::core::parse_json (R"JSON( {
84
114
"$schema": "https://json-schema.org/draft/2020-12/schema",
85
- "$ref": "tag: core.sourcemeta.com,2025:wrap #/items",
115
+ "$ref": "__sourcemeta- core-wrap__ #/items",
86
116
"$defs": {
87
117
"schema": {
88
118
"$schema": "https://json-schema.org/draft/2020-12/schema",
89
- "$id": "tag: core.sourcemeta.com,2025:wrap ",
119
+ "$id": "__sourcemeta- core-wrap__ ",
90
120
"items": {
91
121
"type": "string"
92
122
}
@@ -112,11 +142,11 @@ TEST(JSONSchema_wrap,
112
142
113
143
const auto expected{sourcemeta::core::parse_json (R"JSON( {
114
144
"$schema": "https://json-schema.org/draft/2020-12/schema",
115
- "$ref": "tag: core.sourcemeta.com,2025:wrap #/items",
145
+ "$ref": "__sourcemeta- core-wrap__ #/items",
116
146
"$defs": {
117
147
"schema": {
118
148
"$schema": "https://json-schema.org/draft/2020-12/schema",
119
- "$id": "tag: core.sourcemeta.com,2025:wrap ",
149
+ "$id": "__sourcemeta- core-wrap__ ",
120
150
"items": {
121
151
"type": "string"
122
152
}
0 commit comments