Skip to content

Instantly share code, notes, and snippets.

@chuwy
Last active Jun 17, 2020
Embed
What would you like to do?
Second version of Iglu root metaschema

Files

  • metaschema.json - new root metaschema to put in $schema properties
  • example-meta.json - example registry metaschema, i.e. one hosted on Acme Ltd. (Mixpanel, Iteratively, Snowplow) Iglu registry and thus specific to all its schemas. Can have 2-0-0 or 1-0-0 root metaschema
  • example-schema.json - plain (non-meta, usual) schema hosting on Acme Ltd. registry and containing metadata described by above metaschema

Changes

Compared to 1-0-0

Unrelated to metaschema

Took an opportunity to fix some long-standing issues in 1-0-0.

  • Forced version regex to always start with 1 or higher number (0-0-1 is explicitly invalid according to SchemaVer)
  • Bumped schema body to JSON Schema v7
  • Bumped metaschema to 2-0-0 making it recursive. If server will be hosting it with metadata property AND 1-0-0 it will considered invalid

Metadata

  • Mentioned isPublic, createdAt, updatedAt. Iglu Server already attaches them, but we never took an opportinity to formalise it
  • I'd like add some descriptions as well, but went without it to make the schema more concise
{
"$schema":"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/2-0-0#",
"self": {
"vendor": "com.acme",
"name": "meta",
"format": "jsonschema",
"version": "1-0-0"
},
"properties": {
"isPublic": {
"type":"boolean"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"display_name": {
"description": "Human-readable version of a name",
"type": "string"
},
"entity": {
"description": "Kind of an entity described by the schema",
"enum": [
"EVENT",
"CONTEXT",
"CONFIGURATION"
]
},
"companions": {
"description": "List of entities that must be associated with an entity",
"type": "array",
"items": {
"description": "Iglu URI",
"type": "string",
"format": "^iglu:([a-zA-Z0-9-_.]+)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)/([1-9][0-9]*(?:-(?:0|[1-9][0-9]*)){2})$)"
}
}
}
}
{
"$schema":"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/2-0-0#",
"self": {
"vendor": "com.acme",
"name": "link_click",
"format": "jsonschema",
"version": "1-0-0"
},
"metadata": {
"isPublic": true,
"createdAt": "2020-06-20T23:00:05Z",
"updatedAt": "2020-06-20T23:00:05Z",
"display_name": "Схема для кликов",
"entity": "EVENT",
"companions": [
"iglu:com.mixpanel/browser_info/jsonschema/1-0-0",
"iglu:ly.iterative/user/jsonschema/2-0-0"
]
},
"target_url": {
"description": "Just a plain schema property",
"type": "string",
"format": "uri"
}
}
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/2-0-0#",
"description": "Meta-schema for self-describing JSON schema",
"self": {
"vendor": "com.snowplowanalytics.self-desc",
"name": "schema",
"format": "jsonschema",
"version": "2-0-0"
},
"allOf": [
{
"properties": {
"self": {
"type": "object",
"properties": {
"vendor": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_.]+$"
},
"name": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_]+$"
},
"format": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_]+$"
},
"version": {
"type": "string",
"pattern": "^[1-9][0-9]*-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)$"
}
},
"required": [ "vendor", "name", "format", "version" ],
"additionalProperties": false
},
"metadata": {
"type": "object",
"properties": {
"isPublic": { "type": "boolean" },
"createdAt": { "type": "string", "format": "date-time" },
"updatedAt": { "type": "string", "format": "date-time" }
},
"additionalProperties": true
}
},
"required": [ "self" ]
},
{
"$ref": "http://json-schema.org/draft-07/schema#"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment