diff --git a/Makefile b/Makefile index 92baf0fc..5e333607 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,8 @@ help: ## Show this help. @egrep -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}' .PHONY: tests -test: ## Run all document related checks found in tox: pytest, jsonformat, validate, jsonschema - tox run -e pytest,jsonformat,validate,jsonschema +test: ## Run all document related checks found in tox: pytest, jsonformat, validate + tox run -e pytest,jsonformat,validate .PHONY: generate_docs generate_docs: ## Generate the Markdown files based on the YAML definitions diff --git a/definitions/EiffelActivityCanceledEvent/1.0.0.yml b/definitions/EiffelActivityCanceledEvent/1.0.0.yml index e007f8b1..3bc9fbbc 100644 --- a/definitions/EiffelActivityCanceledEvent/1.0.0.yml +++ b/definitions/EiffelActivityCanceledEvent/1.0.0.yml @@ -44,7 +44,7 @@ required: - meta - data - links -additionalProperties: false +additonalProperties: false _links: ACTIVITY_EXECUTION: description: Declares the activity execution that was canceled. diff --git a/definitions/EiffelActivityCanceledEvent/1.1.0.yml b/definitions/EiffelActivityCanceledEvent/1.1.0.yml index 4b04b45f..5e025367 100644 --- a/definitions/EiffelActivityCanceledEvent/1.1.0.yml +++ b/definitions/EiffelActivityCanceledEvent/1.1.0.yml @@ -44,7 +44,7 @@ required: - meta - data - links -additionalProperties: false +additonalProperties: false _links: ACTIVITY_EXECUTION: description: Declares the activity execution that was canceled. diff --git a/definitions/EiffelActivityCanceledEvent/2.0.0.yml b/definitions/EiffelActivityCanceledEvent/2.0.0.yml index a0caf5a6..a1b10ee3 100644 --- a/definitions/EiffelActivityCanceledEvent/2.0.0.yml +++ b/definitions/EiffelActivityCanceledEvent/2.0.0.yml @@ -44,7 +44,7 @@ required: - meta - data - links -additionalProperties: false +additonalProperties: false _links: ACTIVITY_EXECUTION: description: Declares the activity execution that was canceled. diff --git a/definitions/EiffelActivityCanceledEvent/3.0.0.yml b/definitions/EiffelActivityCanceledEvent/3.0.0.yml index 34f83791..1e0e9304 100644 --- a/definitions/EiffelActivityCanceledEvent/3.0.0.yml +++ b/definitions/EiffelActivityCanceledEvent/3.0.0.yml @@ -44,7 +44,7 @@ required: - meta - data - links -additionalProperties: false +additonalProperties: false _links: ACTIVITY_EXECUTION: description: Declares the activity execution that was canceled. diff --git a/definitions/EiffelActivityCanceledEvent/3.1.0.yml b/definitions/EiffelActivityCanceledEvent/3.1.0.yml index 33d81396..f6ab2bce 100644 --- a/definitions/EiffelActivityCanceledEvent/3.1.0.yml +++ b/definitions/EiffelActivityCanceledEvent/3.1.0.yml @@ -44,7 +44,7 @@ required: - meta - data - links -additionalProperties: false +additonalProperties: false _links: ACTIVITY_EXECUTION: description: Declares the activity execution that was canceled. diff --git a/definitions/EiffelActivityCanceledEvent/3.2.0.yml b/definitions/EiffelActivityCanceledEvent/3.2.0.yml index 1c73daeb..a94fd492 100644 --- a/definitions/EiffelActivityCanceledEvent/3.2.0.yml +++ b/definitions/EiffelActivityCanceledEvent/3.2.0.yml @@ -44,7 +44,7 @@ required: - meta - data - links -additionalProperties: false +additonalProperties: false _links: ACTIVITY_EXECUTION: description: Declares the activity execution that was canceled. diff --git a/definitions/EiffelActivityCanceledEvent/4.0.0.yml b/definitions/EiffelActivityCanceledEvent/4.0.0.yml new file mode 100644 index 00000000..3d64f086 --- /dev/null +++ b/definitions/EiffelActivityCanceledEvent/4.0.0.yml @@ -0,0 +1,121 @@ +# Copyright 2017-2024 Ericsson AB and others. +# For a full list of individual contributors, please see the commit history. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +$schema: http://json-schema.org/draft-04/schema# +_abbrev: ActC +_description: The EiffelActivityCanceledEvent signals that a previously + triggered activity execution has been canceled _before it has started_. + This is typically used in queuing situations where a queued execution + is dequeued. It is recommended that __CAUSE__ links be used to indicate + the reason. +type: object +properties: + meta: + $ref: ../EiffelMetaProperty/3.1.0.yml + data: + type: object + properties: + reason: + _description: Any human readable information as to the reason + for dequeueing. + type: string + customData: + type: array + items: + $ref: ../EiffelCustomDataProperty/1.0.0.yml + additionalProperties: false + links: + type: array + items: + $ref: ../EiffelEventLink/1.1.1.yml +required: + - meta + - data + - links +additionalProperties: false +_links: + ACTIVITY_EXECUTION: + description: Declares the activity execution that was canceled. + In other words, [EiffelActivityTriggeredEvent](../eiffel-vocabulary/EiffelActivityTriggeredEvent.md) + acts as a handle for the activity execution. This differs from + __CONTEXT__. In __ACTIVITY_EXECUTION__ the source carries information + pertaining to the target (i.e. the activity started, finished + or was canceled). In __CONTEXT__, on the other hand, the source + constitutes a subset of the target (e.g. this test case was executed + as part of that activity or test suite). + required: true + multiple: false + targets: + any_type: false + types: + - EiffelActivityTriggeredEvent + CAUSE: + description: While for most events it is recommended that __CAUSE__ + SHOULD not be used in conjunction with __CONTEXT__, EiffelActivityCanceledEvent + is a special case as it represents a deviation from previous + intention. Therefore it is recommended that __CAUSE__ always + be included where applicable. + required: false + multiple: true + targets: + any_type: true + types: [] + CONTEXT: + description: Identifies the activity or test suite of which this + event constitutes a part. + required: false + multiple: false + targets: + any_type: false + types: + - EiffelActivityTriggeredEvent + - EiffelTestSuiteStartedEvent + FLOW_CONTEXT: + description: 'Identifies the flow context of the event: which is + the continuous integration and delivery flow in which this occurred + – e.g. which product, project, track or version this is applicable + to.' + required: false + multiple: true + targets: + any_type: false + types: + - EiffelFlowContextDefinedEvent +_history: + - version: 4.0.0 + changes: Fix bug in schema regarding additionalProperties (see [Issue 376](https://github.com/eiffel-community/eiffel/issues/376)). + - version: 3.2.0 + introduced_in: edition-arica + changes: Add schema URL to the meta object (see [Issue 280](https://github.com/eiffel-community/eiffel/issues/280)). + - version: 3.1.0 + introduced_in: edition-lyon + changes: Add links.domainId member (see [Issue 233](https://github.com/eiffel-community/eiffel/issues/233)). + - version: 3.0.0 + introduced_in: edition-agen + changes: Improved information integrity protection (see [Issue + 185](https://github.com/eiffel-community/eiffel/issues/185)). + - version: 2.0.0 + introduced_in: edition-agen + changes: Introduced purl identifiers instead of GAVs (see [Issue + 182](https://github.com/eiffel-community/eiffel/issues/182)) + - version: 1.1.0 + introduced_in: edition-toulouse + changes: Multiple links of type FLOW_CONTEXT allowed. + - version: 1.0.0 + introduced_in: edition-bordeaux + changes: Initial version. +_examples: + - title: Simple example + url: ../examples/events/EiffelActivityCanceledEvent/simple.json diff --git a/eiffel-vocabulary/EiffelActivityCanceledEvent.md b/eiffel-vocabulary/EiffelActivityCanceledEvent.md index a6201112..fe4178a7 100644 --- a/eiffel-vocabulary/EiffelActivityCanceledEvent.md +++ b/eiffel-vocabulary/EiffelActivityCanceledEvent.md @@ -1,5 +1,5 @@ @@ -177,6 +177,7 @@ __Description:__ A URI pointing at a location from where the schema used when cr | Version | Introduced in | Changes | | ------- | ------------- | ------- | +| 4.0.0 | Not yet released in an edition | Fix bug in schema regarding additionalProperties (see [Issue 376](https://github.com/eiffel-community/eiffel/issues/376)). | | 3.2.0 | [edition-arica](../../../tree/edition-arica) | Add schema URL to the meta object (see [Issue 280](https://github.com/eiffel-community/eiffel/issues/280)). | | 3.1.0 | [edition-lyon](../../../tree/edition-lyon) | Add links.domainId member (see [Issue 233](https://github.com/eiffel-community/eiffel/issues/233)). | | 3.0.0 | [edition-agen](../../../tree/edition-agen) | Improved information integrity protection (see [Issue 185](https://github.com/eiffel-community/eiffel/issues/185)). | diff --git a/schemas/EiffelActivityCanceledEvent/1.0.0.json b/schemas/EiffelActivityCanceledEvent/1.0.0.json index 81c7b761..b0419e70 100644 --- a/schemas/EiffelActivityCanceledEvent/1.0.0.json +++ b/schemas/EiffelActivityCanceledEvent/1.0.0.json @@ -152,5 +152,5 @@ "data", "links" ], - "additionalProperties": false + "additonalProperties": false } diff --git a/schemas/EiffelActivityCanceledEvent/1.1.0.json b/schemas/EiffelActivityCanceledEvent/1.1.0.json index bc00332a..08e1d241 100644 --- a/schemas/EiffelActivityCanceledEvent/1.1.0.json +++ b/schemas/EiffelActivityCanceledEvent/1.1.0.json @@ -152,5 +152,5 @@ "data", "links" ], - "additionalProperties": false + "additonalProperties": false } diff --git a/schemas/EiffelActivityCanceledEvent/2.0.0.json b/schemas/EiffelActivityCanceledEvent/2.0.0.json index 7f559237..7c8e2810 100644 --- a/schemas/EiffelActivityCanceledEvent/2.0.0.json +++ b/schemas/EiffelActivityCanceledEvent/2.0.0.json @@ -136,5 +136,5 @@ "data", "links" ], - "additionalProperties": false + "additonalProperties": false } diff --git a/schemas/EiffelActivityCanceledEvent/3.0.0.json b/schemas/EiffelActivityCanceledEvent/3.0.0.json index 1911de6a..edf01ca0 100644 --- a/schemas/EiffelActivityCanceledEvent/3.0.0.json +++ b/schemas/EiffelActivityCanceledEvent/3.0.0.json @@ -178,5 +178,5 @@ "data", "links" ], - "additionalProperties": false + "additonalProperties": false } diff --git a/schemas/EiffelActivityCanceledEvent/3.1.0.json b/schemas/EiffelActivityCanceledEvent/3.1.0.json index a6a4ddc1..6e8f25e8 100644 --- a/schemas/EiffelActivityCanceledEvent/3.1.0.json +++ b/schemas/EiffelActivityCanceledEvent/3.1.0.json @@ -181,5 +181,5 @@ "data", "links" ], - "additionalProperties": false + "additonalProperties": false } diff --git a/schemas/EiffelActivityCanceledEvent/3.2.0.json b/schemas/EiffelActivityCanceledEvent/3.2.0.json index 7993f7e1..cb4655c2 100644 --- a/schemas/EiffelActivityCanceledEvent/3.2.0.json +++ b/schemas/EiffelActivityCanceledEvent/3.2.0.json @@ -184,5 +184,5 @@ "data", "links" ], - "additionalProperties": false + "additonalProperties": false } diff --git a/schemas/EiffelActivityCanceledEvent/4.0.0.json b/schemas/EiffelActivityCanceledEvent/4.0.0.json new file mode 100644 index 00000000..fb8b08a9 --- /dev/null +++ b/schemas/EiffelActivityCanceledEvent/4.0.0.json @@ -0,0 +1,188 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "meta": { + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + }, + "type": { + "type": "string", + "enum": [ + "EiffelActivityCanceledEvent" + ] + }, + "version": { + "type": "string", + "enum": [ + "4.0.0" + ], + "default": "4.0.0" + }, + "time": { + "type": "integer" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "source": { + "type": "object", + "properties": { + "domainId": { + "type": "string" + }, + "host": { + "type": "string" + }, + "name": { + "type": "string" + }, + "serializer": { + "type": "string", + "pattern": "^pkg:" + }, + "uri": { + "type": "string" + } + }, + "additionalProperties": false + }, + "security": { + "type": "object", + "properties": { + "authorIdentity": { + "type": "string" + }, + "integrityProtection": { + "type": "object", + "properties": { + "signature": { + "type": "string" + }, + "alg": { + "type": "string", + "enum": [ + "HS256", + "HS384", + "HS512", + "RS256", + "RS384", + "RS512", + "ES256", + "ES384", + "ES512", + "PS256", + "PS384", + "PS512" + ] + }, + "publicKey": { + "type": "string" + } + }, + "required": [ + "signature", + "alg" + ], + "additionalProperties": false + }, + "sequenceProtection": { + "type": "array", + "items": { + "type": "object", + "properties": { + "sequenceName": { + "type": "string" + }, + "position": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "sequenceName", + "position" + ] + } + } + }, + "additionalProperties": false, + "required": [ + "authorIdentity" + ] + }, + "schemaUri": { + "type": "string" + } + }, + "required": [ + "id", + "type", + "version", + "time" + ], + "additionalProperties": false + }, + "data": { + "type": "object", + "properties": { + "reason": { + "type": "string" + }, + "customData": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": {} + }, + "required": [ + "key", + "value" + ], + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + "links": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "target": { + "type": "string", + "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + }, + "domainId": { + "type": "string" + } + }, + "required": [ + "type", + "target" + ], + "additionalProperties": false + } + } + }, + "required": [ + "meta", + "data", + "links" + ], + "additionalProperties": false +} diff --git a/test_jsonschema.py b/test_jsonschema.py deleted file mode 100644 index 8c4c6d27..00000000 --- a/test_jsonschema.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2022-2023 Axis Communications AB and others. -# For a full list of individual contributors, please see the commit history. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import json -import subprocess - -import jsonschema -import pytest - - -@pytest.mark.parametrize( - "filename", - subprocess.check_output(["git", "ls-files", "--exclude-standard", "schemas/*.json"]) - .decode("utf-8") - .splitlines(), -) -def test_json_schema(filename): - with open(filename) as input_file: - event_schema = json.loads(input_file.read()) - - stricter_metaschema = dict( - jsonschema.Draft4Validator.META_SCHEMA, additionalProperties=False - ) - StrictDraft4Validator = jsonschema.validators.create( - stricter_metaschema, jsonschema.Draft4Validator.VALIDATORS, "StrictDraft4" - ) - StrictDraft4Validator.check_schema(event_schema) diff --git a/tox.ini b/tox.ini index b5c2fee6..c89a9d0d 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,6 @@ envlist = black isort jsonformat - jsonschema pytest markdownlint @@ -50,12 +49,6 @@ deps = pytest==6.2.5 commands = pytest test_jsonformat.py {posargs} -[testenv:jsonschema] -deps = - pytest==6.2.5 - jsonschema==4.20.0 -commands = pytest test_jsonschema.py {posargs} - [testenv:pytest] deps = -rrequirements.txt