From a7e844a05713352506f99644e3c0b36278f3266e Mon Sep 17 00:00:00 2001 From: Chris Hoge Date: Fri, 29 Apr 2016 15:53:47 -0500 Subject: [PATCH] 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 --- doc/source/schema/1.5.json | 313 +++++++++++++++++++++++++++++++++++++ next.json | 15 +- test-requirements.txt | 2 + tox.ini | 15 +- 4 files changed, 334 insertions(+), 11 deletions(-) create mode 100644 doc/source/schema/1.5.json diff --git a/doc/source/schema/1.5.json b/doc/source/schema/1.5.json new file mode 100644 index 00000000..427283d9 --- /dev/null +++ b/doc/source/schema/1.5.json @@ -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" + } + } + } + } + } + } + } + } +} diff --git a/next.json b/next.json index 0c07ee0c..8802565b 100644 --- a/next.json +++ b/next.json @@ -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": {} } } }, diff --git a/test-requirements.txt b/test-requirements.txt index eaf3557b..64780122 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,7 @@ pygments +demjson doc8 +jsonschema oslosphinx sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 sphinxcontrib.datatemplates diff --git a/tox.ini b/tox.ini index 9de0a2c7..dac0480a 100644 --- a/tox.ini +++ b/tox.ini @@ -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 +