Added formal 1.5 json schema for gating against.

Added formal 1.5 json schema to gate current guidelines against.
Updated next json files to validate against schema,
and updated next guideline schema version reference to 1.5,
with syntax changes that fixed ambiguous empty content and
duplication of data. Added tox jobs to lint and validate next
json files.

Change-Id: I13ee6b16115588527fde070e34874edf919aa864
This commit is contained in:
Chris Hoge 2016-04-29 15:53:47 -05:00
parent 119de667d2
commit a7e844a057
4 changed files with 334 additions and 11 deletions

313
doc/source/schema/1.5.json Normal file
View File

@ -0,0 +1,313 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://git.openstack.org/cgit/openstack/defcore/doc/source/schema/1.5.json",
"type": "object",
"required": [
"id",
"schema",
"reference",
"source",
"status",
"replaces",
"target_approval",
"releases",
"platform",
"components",
"capabilities",
"designated-sections",
"criteria"
],
"properties": {
"id": {
"type": "string"
},
"schema": {
"type": "string"
},
"reference": {
"type": "string"
},
"source": {
"type": "string"
},
"status": {
"enum": [ "draft", "advisory", "approved", "superceded" ]
},
"replaces": {
"type": "string"
},
"target_approval": {
"type": "string",
"pattern": "\\d{4}-\\d{2}-\\d{2}"
},
"releases": {
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
},
"platform": {
"type": "object",
"properties": {
"required": {
"type": "array",
"items": {
"type": "string"
}
},
"advisory": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": {
"type": "array",
"items": {
"type": "string"
}
},
"removed": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"components": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/component"
}
},
"additionalProperties": false
},
"capabilities": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/capabilty"
}
}
},
"designated-sections": {
"type": "object",
"required": [ "required", "advisory", "deprecated", "removed", "informational" ],
"properties": {
"required": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/designated-section"
}
}
},
"advisory": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/designated-section"
}
}
},
"deprecated": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/designated-section"
}
}
},
"removed": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/designated-section"
}
}
},
"informational": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/designated-section"
}
}
}
},
"additionalProperties": false
},
"criteria": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/criteria"
}
},
"additionalProperties": false
}
},
"definitions": {
"component": {
"type": "object",
"required": [ "required", "advisory", "deprecated", "removed" ],
"properties": {
"required": {
"type": "array",
"items": {
"type": "string"
}
},
"advisory": {
"type": "array",
"items": {
"type": "string"
}
},
"deprecated": {
"type": "array",
"items": {
"type": "string"
}
},
"removed": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
},
"capability": {
"type": "object",
"required": [ "achievements",
"admin",
"description",
"project",
"require-since",
"tests"
],
"properties": {
"achievements": {
"type": "array",
"items": {
"enum": [
"foundation",
"complete",
"proximity",
"clients",
"discover",
"sticky",
"future",
"atomic",
"stable",
"tools",
"deployed",
"TODO ADD LAST ITEM HERE"
],
"uniqueItems": true
}
},
"admin": {
"type": "boolean"
},
"description": {
"type": "string"
},
"project": {
"type": "string"
},
"required-since": {
"type": "string",
"pattern": "[^$|^\\d{4}-\\d{2}-\\d{2}$]"
},
"tests": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"$ref": "#/definitions/test"
}
}
}
}
},
"criteria": {
"type": "object",
"required": [ "Description", "name", "weight" ],
"properties": {
"Description": {
"type": "string"
},
"name": {
"type": "string"
},
"weight": {
"type": "integer"
}
}
},
"test": {
"type": "object",
"required": [ "idempotent_id" ],
"properties": {
"idempotent_id": {
"type": "string"
},
"flagged": {
"type": "object",
"required": [ "reason", "action", "date" ],
"properties": {
"reason": {
"type": "string",
"pattern": "^D\\d{3} \\w+"
},
"action": {
"type": "string"
},
"date": {
"type": "string",
"pattern": "\\d{4}-\\d{2}-\\d{2}"
}
}
}
}
},
"designated-section": {
"type": "object",
"required": [ "guidance", "comment", "sections" ],
"properties": {
"guidance": {
"type": "string"
},
"comment": {
"type": "string"
},
"sections": {
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "object",
"required": [ "description", "designated", "comment" ],
"properties": {
"description": {
"type": "string"
},
"designated": {
"type": "boolean"
},
"comment": {
"type": "string"
}
}
}
}
}
}
}
}
}

View File

@ -1,7 +1,7 @@
{
"id": "next",
"schema": "1.4",
"reference": "https://git.openstack.org/cgit/openstack/defcore/schema/1.3.rst",
"schema": "1.5",
"reference": "https://git.openstack.org/cgit/openstack/defcore/schema/1.5.json",
"source": "http://git.openstack.org/cgit/openstack/defcore/",
"status": "draft",
"cutoff_score": "74",
@ -86,7 +86,7 @@
"images-v2-get",
"volumes-v2-upload",
"volumes-v2-qos",
"volumes-v2-transfer",
"volumes-v2-transfer"
],
"deprecated": [
"compute-auth-create",
@ -2315,9 +2315,6 @@
"tempest.api.network.test_routers_negative.RoutersNegativeTest.test_show_non_existent_router_returns_404": {
"idempotent_id": "id-c2a70d72-8826-43a7-8208-0209e6360c47"
},
"tempest.api.network.test_routers_negative.RoutersNegativeTest.test_show_non_existent_router_returns_404": {
"idempotent_id": "id-c2a70d72-8826-43a7-8208-0209e6360c47"
},
"tempest.api.network.test_routers.RoutersTest.test_update_extra_route": {
"idempotent_id": "id-c86ac3a8-50bd-4b00-a6b8-62af84a0765c"
},
@ -3121,19 +3118,19 @@
"guidance": "Not a core capability, no position at this time",
"required": false,
"comment": "",
"sections": []
"sections": {}
},
"horizon": {
"guidance": "Not a core capability, no position at this time",
"required": false,
"comment": "",
"sections": []
"sections": {}
},
"ceilometer": {
"guidance": "Not a core capability, no position at this time",
"required": false,
"comment": "",
"sections": []
"sections": {}
}
}
},

View File

@ -1,5 +1,7 @@
pygments
demjson
doc8
jsonschema
oslosphinx
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
sphinxcontrib.datatemplates

15
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = docs,doc8,pep8
envlist = docs,doc8,pep8,jsonlint,jsonschema
minversion = 1.6
skipsdist = True
@ -33,6 +33,17 @@ whitelist_externals =
[flake8]
# E125 is deliberately excluded.
# See https://github.com/jcrocholl/pep8/issues/126
ignore = E125
exclude = .venv,.git,.tox,doc,conf.py
[testenv:jsonlint]
commands=
jsonlint -s next.json
jsonlint -s 2015.07.json
jsonlint -s 2016.01.json
jsonlint -s doc/source/schema/1.5.json
[testenv:jsonschema]
commands=
jsonschema doc/source/schema/1.5.json -i next.json