Bug 1337927 - Add version support to schema filenames (#44)

* Bug 1337927 - Refactor repo layout to add versions

Move files around and embed a major version inside the schema filename.

* Add previous core schema versions

* Remove the vacuous schema.

* Fix a spurious comma
This commit is contained in:
Mark Reid 2017-05-03 16:52:41 -03:00 коммит произвёл Mike Trinkala
Родитель ef065dafd8
Коммит 5c709b1acd
29 изменённых файлов: 562 добавлений и 11 удалений

Просмотреть файл

Просмотреть файл

@ -0,0 +1,41 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 1 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 2 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 3 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 4 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 5 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 6 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 7 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

@ -0,0 +1,74 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"title" : "core",
"properties" : {
"v" : {
"type" : "integer",
"enum" : [ 8 ]
},
"clientId" : {
"type" : "string",
"pattern" : "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"seq" : {
"type" : "integer",
"minimum" : 0
},
"locale" : {
"type" : "string"
},
"os" : {
"type" : "string"
},
"osversion" : {
"type" : "string"
},
"device" : {
"type" : "string"
},
"arch" : {
"type" : "string"
},
"profileDate" : {
"type" : "integer"
},
"defaultSearch" : {
"type" : ["string", "null"]
},
"distributionId" : {
"type" : "string"
},
"created" : {
"type" : "string"
},
"tz" : {
"type" : "integer"
},
"sessions" : {
"type" : "integer"
},
"durations" : {
"type" : "integer"
},
"searches" : {
"type" : "object",
"additionalProperties": {
"type": "integer"
}
},
"experiments" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"flashUsage" : {
"type" : "integer"
},
"campaign": {
"type": "string"
}
},
"required" : ["v", "clientId", "seq", "arch", "device", "locale", "os", "osversion"]
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,8 +0,0 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"type" : "object",
"name" : "vacuous",
"properties" : {
},
"required" : []
}

Просмотреть файл

@ -8,7 +8,7 @@ class Test_validate(unittest.TestCase):
def test_metadata(self):
for t in VALIDATION_TYPES:
sample_data_filename = os.path.join(LOCAL, "sample_metadata_{}.json".format(t))
sample_schema_filename = os.path.join(LOCAL, "../../metadata/metadata_{}.schema.json".format(t))
sample_schema_filename = os.path.join(LOCAL, "../../schemas/metadata/{0}/{0}.1.schema.json".format(t))
with open(sample_data_filename) as data_file, open(sample_schema_filename) as schema_file:
data = json.load(data_file)
schema = json.load(schema_file)

Просмотреть файл

@ -3,9 +3,9 @@ from jsonschema import validate, ValidationError
LOCAL = os.path.dirname(__file__)
SAMPLE_PING_PATH = os.path.join(LOCAL, 'sample_v4_ping.json')
MAIN_SCHEMA_PATH = os.path.join(LOCAL, '../../telemetry/main.schema.json')
MAIN_SCHEMA_PATH = os.path.join(LOCAL, '../../schemas/telemetry/main/main.4.schema.json')
MODULES_PING_PATHS = [os.path.join(LOCAL, 'modules_v1_ping_linux.json'), os.path.join(LOCAL, 'modules_v1_ping_windows.json')]
MODULES_SCHEMA_PATH = os.path.join(LOCAL, '../../telemetry/modules.schema.json')
MODULES_SCHEMA_PATH = os.path.join(LOCAL, '../../schemas/telemetry/modules/modules.4.schema.json')
class Test_validate(unittest.TestCase):