Skip to content

Commit

Permalink
Bump self-desc schema version to 1-0-1 (close #157)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Mar 27, 2023
1 parent 51241ad commit 3ee7a62
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 =
"""{
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/test/resources/test_schema_1.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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": {
Expand Down Expand Up @@ -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": {}
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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)) }

Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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#]"))
}
}

Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 3ee7a62

Please sign in to comment.