Skip to content

Commit 711e239

Browse files
committed
rollback $$ usage
1 parent 38cf7bc commit 711e239

File tree

1 file changed

+41
-41
lines changed
  • json-schema-validator/src/commonTest/kotlin/io/github/optimumcode/json/schema/base

1 file changed

+41
-41
lines changed

json-schema-validator/src/commonTest/kotlin/io/github/optimumcode/json/schema/base/JsonSchemaTest.kt

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class JsonSchemaTest : FunSpec() {
2121
test("loads schema object from string description") {
2222
shouldNotThrowAny {
2323
JsonSchema.fromDefinition(
24-
$$"""
24+
"""
2525
{
26-
"$schema": "http://json-schema.org/draft-07/schema#",
26+
"${KEY}schema": "http://json-schema.org/draft-07/schema#",
2727
"type": "string"
2828
}
2929
""".trimIndent(),
@@ -46,9 +46,9 @@ class JsonSchemaTest : FunSpec() {
4646
test("loads schema with definitions") {
4747
shouldNotThrowAny {
4848
JsonSchema.fromDefinition(
49-
$$"""
49+
"""
5050
{
51-
"$schema": "http://json-schema.org/draft-07/schema#",
51+
"${KEY}schema": "http://json-schema.org/draft-07/schema#",
5252
"definitions": {
5353
"positiveInteger": {
5454
"type": "integer",
@@ -64,11 +64,11 @@ class JsonSchemaTest : FunSpec() {
6464
test("loads schema with self reference") {
6565
shouldNotThrowAny {
6666
JsonSchema.fromDefinition(
67-
$$"""
67+
"""
6868
{
69-
"$schema": "http://json-schema.org/draft-07/schema#",
69+
"${KEY}schema": "http://json-schema.org/draft-07/schema#",
7070
"properties": {
71-
"other": { "$ref": "#" }
71+
"other": { "${KEY}ref": "#" }
7272
}
7373
}
7474
""".trimIndent(),
@@ -79,9 +79,9 @@ class JsonSchemaTest : FunSpec() {
7979
test("reports missing reference") {
8080
shouldThrow<IllegalArgumentException> {
8181
JsonSchema.fromDefinition(
82-
$$"""
82+
"""
8383
{
84-
"$schema": "http://json-schema.org/draft-07/schema#",
84+
"${KEY}schema": "http://json-schema.org/draft-07/schema#",
8585
"definitions": {
8686
"positiveInteger": {
8787
"type": "integer",
@@ -90,7 +90,7 @@ class JsonSchemaTest : FunSpec() {
9090
},
9191
"properties": {
9292
"size": {
93-
"$ref": "#/definitions/positiveIntege"
93+
"${KEY}ref": "#/definitions/positiveIntege"
9494
}
9595
}
9696
}
@@ -152,24 +152,24 @@ class JsonSchemaTest : FunSpec() {
152152
withClue(ref) {
153153
shouldNotThrowAny {
154154
JsonSchema.fromDefinition(
155-
$$"""
155+
"""
156156
{
157-
"$id": "http://example.com/root.json",
157+
"${KEY}id": "http://example.com/root.json",
158158
"definitions": {
159-
"A": { "$id": "#foo" },
159+
"A": { "${KEY}id": "#foo" },
160160
"B": {
161-
"$id": "other.json",
161+
"${KEY}id": "other.json",
162162
"definitions": {
163-
"X": { "$id": "#bar" },
164-
"Y": { "$id": "t/inner.json" }
163+
"X": { "${KEY}id": "#bar" },
164+
"Y": { "${KEY}id": "t/inner.json" }
165165
}
166166
},
167167
"C": {
168-
"$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"
168+
"${KEY}id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f"
169169
}
170170
},
171171
"properties": {
172-
"test": { "$ref": "$$ref" }
172+
"test": { "${KEY}ref": "$ref" }
173173
}
174174
}
175175
""".trimIndent(),
@@ -189,9 +189,9 @@ class JsonSchemaTest : FunSpec() {
189189
test("loads schema with supported '$it' \$schema property") {
190190
shouldNotThrowAny {
191191
JsonSchema.fromDefinition(
192-
$$"""
192+
"""
193193
{
194-
"$schema": "$$it",
194+
"${KEY}schema": "$it",
195195
"type": "string"
196196
}
197197
""".trimIndent(),
@@ -207,9 +207,9 @@ class JsonSchemaTest : FunSpec() {
207207
test("reports unsupported '$it' \$schema property") {
208208
shouldThrow<IllegalArgumentException> {
209209
JsonSchema.fromDefinition(
210-
$$"""
210+
"""
211211
{
212-
"$schema": "$$it",
212+
"${KEY}schema": "$it",
213213
"type": "string"
214214
}
215215
""".trimIndent(),
@@ -221,53 +221,53 @@ class JsonSchemaTest : FunSpec() {
221221
test("\$dynamicRef is resolved every time") {
222222
val schema =
223223
JsonSchema.fromDefinition(
224-
$$"""
224+
"""
225225
{
226-
"$schema": "https://json-schema.org/draft/2020-12/schema",
227-
"$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
226+
"${KEY}schema": "https://json-schema.org/draft/2020-12/schema",
227+
"${KEY}id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
228228
"if": {
229229
"properties": {
230230
"kindOfList": { "const": "numbers" }
231231
},
232232
"required": ["kindOfList"]
233233
},
234-
"then": { "$ref": "numberList" },
235-
"else": { "$ref": "stringList" },
234+
"then": { "${KEY}ref": "numberList" },
235+
"else": { "${KEY}ref": "stringList" },
236236
237-
"$defs": {
237+
"${KEY}defs": {
238238
"genericList": {
239-
"$id": "genericList",
239+
"${KEY}id": "genericList",
240240
"properties": {
241241
"list": {
242-
"items": { "$dynamicRef": "#itemType" }
242+
"items": { "${KEY}dynamicRef": "#itemType" }
243243
}
244244
},
245-
"$defs": {
245+
"${KEY}defs": {
246246
"defaultItemType": {
247-
"$comment": "Only needed to satisfy bookending requirement",
248-
"$dynamicAnchor": "itemType"
247+
"${KEY}comment": "Only needed to satisfy bookending requirement",
248+
"${KEY}dynamicAnchor": "itemType"
249249
}
250250
}
251251
},
252252
"numberList": {
253-
"$id": "numberList",
254-
"$defs": {
253+
"${KEY}id": "numberList",
254+
"${KEY}defs": {
255255
"itemType": {
256-
"$dynamicAnchor": "itemType",
256+
"${KEY}dynamicAnchor": "itemType",
257257
"type": "number"
258258
}
259259
},
260-
"$ref": "genericList"
260+
"${KEY}ref": "genericList"
261261
},
262262
"stringList": {
263-
"$id": "stringList",
264-
"$defs": {
263+
"${KEY}id": "stringList",
264+
"${KEY}defs": {
265265
"itemType": {
266-
"$dynamicAnchor": "itemType",
266+
"${KEY}dynamicAnchor": "itemType",
267267
"type": "string"
268268
}
269269
},
270-
"$ref": "genericList"
270+
"${KEY}ref": "genericList"
271271
}
272272
}
273273
}

0 commit comments

Comments
 (0)