From 3ee7a625f85ecdc2e66bf15167da7ea241276886 Mon Sep 17 00:00:00 2001 From: spenes Date: Mon, 27 Mar 2023 17:28:45 +0300 Subject: [PATCH] Bump self-desc schema version to 1-0-1 (close #157) --- .../iglu.schemaddl/jsonschema/Schema.scala | 2 +- .../jsonschema/SelfSyntaxChecker.scala | 3 +- .../src/test/resources/test_schema_1.json | 2 +- .../jsonschema/SanityLinterSpec.scala | 28 +++++++++---------- .../jsonschema/SelfSyntaxCheckerSpec.scala | 16 +++++------ 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/Schema.scala b/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/Schema.scala index 124435a5..8376565e 100644 --- a/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/Schema.scala +++ b/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/Schema.scala @@ -63,7 +63,7 @@ case class Schema(multipleOf: Option[NumberProperty.MultipleOf] object Schema { - val SelfDescribingUri: URI = URI.create("http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#") + val SelfDescribingUri: URI = URI.create("http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#") /** Schema not containing any other child schemas */ case class Primitive(schema: Schema) extends AnyVal diff --git a/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/SelfSyntaxChecker.scala b/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/SelfSyntaxChecker.scala index 624494c9..f3ebe32b 100644 --- a/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/SelfSyntaxChecker.scala +++ b/modules/core/src/main/scala/com.snowplowanalytics/iglu.schemaddl/jsonschema/SelfSyntaxChecker.scala @@ -22,7 +22,6 @@ import com.networknt.schema.{SpecVersion, JsonSchema, JsonSchemaFactory, SchemaV import io.circe.jackson.circeToJackson -import com.snowplowanalytics.iglu.core.SelfDescribingSchema.SelfDescribingUri import com.snowplowanalytics.iglu.core.circe.MetaSchemas import com.snowplowanalytics.iglu.schemaddl.jsonschema.Linter.Level @@ -39,7 +38,7 @@ import com.snowplowanalytics.iglu.schemaddl.jsonschema.Linter.Message */ object SelfSyntaxChecker { - private val MetaSchemaUri = SelfDescribingUri.toString + private val MetaSchemaUri = "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#" private val V4SchemaText = """{ diff --git a/modules/core/src/test/resources/test_schema_1.json b/modules/core/src/test/resources/test_schema_1.json index 8b6d33bb..618d588d 100644 --- a/modules/core/src/test/resources/test_schema_1.json +++ b/modules/core/src/test/resources/test_schema_1.json @@ -1,5 +1,5 @@ { - "$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "description": "Schema for a Mandrill message clicked event", "self": { "vendor": "com.mandrill", diff --git a/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SanityLinterSpec.scala b/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SanityLinterSpec.scala index 43187968..ddd57822 100644 --- a/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SanityLinterSpec.scala +++ b/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SanityLinterSpec.scala @@ -50,7 +50,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e1 = { val schema = json"""{ - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "minLength": 3 }""".schema @@ -66,7 +66,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e2 = { val schema = json"""{ - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "additionalProperties": { "properties": { "nestedObject": { @@ -116,7 +116,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e3 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "additionalProperties": false, "properties": { "oneKey": {} @@ -139,7 +139,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e4 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "properties": { "sku": { @@ -195,7 +195,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e5 = { val schema = json"""{ - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "properties": { "sku": { @@ -244,7 +244,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e6 = { val schema = json"""{ - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "array", "items": { "type": "object", @@ -275,7 +275,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e7 = { val schema = json"""{ - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "properties": { "name": { @@ -303,7 +303,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e8 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "properties": { "name": { @@ -333,7 +333,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e9 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "string", "minLength": 3, "maxLength": 65536 @@ -352,7 +352,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e10 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "description": "Placeholder object", "properties": { @@ -401,7 +401,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e11 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "type": "object", "description": "desc text", "properties": { @@ -523,7 +523,7 @@ class SanityLinterSpec extends Specification { def is = s2""" val skippedLinters = List(Linter.description) val expected = Map("/" -> - NonEmptyList.of(s"Given $$schema is not http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#")) + NonEmptyList.of(s"Given $$schema is not http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#")) val res = lint(schema, Linter.allLintersMap.values.toList.diff(skippedLinters)).map { case (k, v) => (k.show, v.map(_.show)) } @@ -533,7 +533,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e14 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "self": { "vendor": "com.test.valid", "name": "test_schema", @@ -604,7 +604,7 @@ class SanityLinterSpec extends Specification { def is = s2""" def e15 = { val schema = json""" { - "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "self": { "vendor": "com.test.valid", "name": "test_schema", diff --git a/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SelfSyntaxCheckerSpec.scala b/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SelfSyntaxCheckerSpec.scala index 857a773a..396a2bbd 100644 --- a/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SelfSyntaxCheckerSpec.scala +++ b/modules/core/src/test/scala/com/snowplowanalytics/iglu/schemaddl/jsonschema/SelfSyntaxCheckerSpec.scala @@ -27,7 +27,7 @@ class SelfSyntaxCheckerSpec extends Specification { "recognize invalid schema property" in { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "description": "Schema for an example event", "self": { "vendor": "com.snowplowanalytics", @@ -87,7 +87,7 @@ class SelfSyntaxCheckerSpec extends Specification { "recognize invalid maxLength type" in { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "description": "Schema for an example event", "self": { "vendor": "com.snowplowanalytics", @@ -139,7 +139,7 @@ class SelfSyntaxCheckerSpec extends Specification { Nil ) => (pointer.value must beEmpty) and - (msg must beEqualTo("$.$schema: does not have a value in the enumeration [http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#]")) + (msg must beEqualTo("$.$schema: does not have a value in the enumeration [http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#]")) } } @@ -160,7 +160,7 @@ class SelfSyntaxCheckerSpec extends Specification { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "self": { "vendor": $vendor, "name": $name, @@ -194,7 +194,7 @@ class SelfSyntaxCheckerSpec extends Specification { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "self": { "vendor": "com.example", "name": "myschema", @@ -216,7 +216,7 @@ class SelfSyntaxCheckerSpec extends Specification { "recognize invalid 'self.supersededBy' type" in { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "description": "Schema for an example event", "self": { "vendor": "com.snowplowanalytics", @@ -238,7 +238,7 @@ class SelfSyntaxCheckerSpec extends Specification { "recognize invalid 'self.supersedes' type" in { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "description": "Schema for an example event", "self": { "vendor": "com.snowplowanalytics", @@ -260,7 +260,7 @@ class SelfSyntaxCheckerSpec extends Specification { "allow valid 'self.supersedes' and 'self.supersededBy' fields" in { val jsonSchema = json"""{ - "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", + "$$schema" : "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-1#", "description": "Schema for an example event", "self": { "vendor": "com.snowplowanalytics",