diff --git a/.github/linters/.eslintrc.yml b/.github/linters/.eslintrc.yml index 41ae6ac2..360a642c 100644 --- a/.github/linters/.eslintrc.yml +++ b/.github/linters/.eslintrc.yml @@ -1,10 +1,23 @@ plugins: - jsonc overrides: - - files: "*.json" + - files: + - "schemas/*.json" + - "examples/*.json" parser: "jsonc-eslint-parser" rules: + # These are the set of rules that belong to jsonc. For more information, + # https://ota-meshi.github.io/eslint-plugin-jsonc/rules + jsonc/comma-dangle: + - error + jsonc/indent: + - error + - 2 jsonc/key-name-casing: - - error - - camelCase: true - snake_case: false + - error + - camelCase: true + snake_case: false + jsonc/key-spacing: + - error + jsonc/no-dupe-keys: + - error diff --git a/custom/schema.json b/custom/schema.json index f20b3aae..ac7ddb7c 100644 --- a/custom/schema.json +++ b/custom/schema.json @@ -1,93 +1,93 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://cdevents.dev/0.5.0-draft/schema/custom", - "properties": { - "context": { - "properties": { - "version": { - "type": "string", - "minLength": 1 - }, - "id": { - "type": "string", - "minLength": 1 - }, - "source": { - "type": "string", - "minLength": 1, - "format": "uri-reference" - }, - "type": { - "type": "string", - "pattern": "^dev.cdeventsx.[a-zA-Z0-9]+-[a-zA-Z]+.[a-zA-Z]+$" - }, - "timestamp": { - "type": "string", - "format": "date-time" - }, - "schemaUri": { - "type": "string", - "minLength": 1, - "format": "uri" - } + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://cdevents.dev/0.5.0-draft/schema/custom", + "properties": { + "context": { + "properties": { + "version": { + "type": "string", + "minLength": 1 }, - "additionalProperties": false, - "type": "object", - "required": [ - "version", - "id", - "source", - "type", - "timestamp" - ] - }, - "subject": { - "properties": { - "id": { - "type": "string", - "minLength": 1 - }, - "source": { - "type": "string", - "minLength": 1, - "format": "uri-reference" - }, - "type": { - "type": "string", - "pattern": "^[a-zA-Z0-9]+-[a-zA-Z]+$" - }, - "content": { - "type": "object", - "additionalProperties": true - } + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "type": { + "type": "string", + "pattern": "^dev.cdeventsx.[a-zA-Z0-9]+-[a-zA-Z]+.[a-zA-Z]+$" }, - "additionalProperties": false, - "type": "object", - "required": [ - "id", - "type", - "content" - ] + "timestamp": { + "type": "string", + "format": "date-time" + }, + "schemaUri": { + "type": "string", + "minLength": 1, + "format": "uri" + } }, - "customData": { - "oneOf": [ - { - "type": "object" - }, - { - "type": "string", - "contentEncoding": "base64" - } - ] + "additionalProperties": false, + "type": "object", + "required": [ + "version", + "id", + "source", + "type", + "timestamp" + ] + }, + "subject": { + "properties": { + "id": { + "type": "string", + "minLength": 1 + }, + "source": { + "type": "string", + "minLength": 1, + "format": "uri-reference" + }, + "type": { + "type": "string", + "pattern": "^[a-zA-Z0-9]+-[a-zA-Z]+$" + }, + "content": { + "type": "object", + "additionalProperties": true + } }, - "customDataContentType": { - "type": "string" - } + "additionalProperties": false, + "type": "object", + "required": [ + "id", + "type", + "content" + ] + }, + "customData": { + "oneOf": [ + { + "type": "object" + }, + { + "type": "string", + "contentEncoding": "base64" + } + ] }, - "additionalProperties": false, - "type": "object", - "required": [ - "context", - "subject" - ] - } \ No newline at end of file + "customDataContentType": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "context", + "subject" + ] +} \ No newline at end of file diff --git a/examples/incident_detected.json b/examples/incident_detected.json index 2229435b..f0ecf90b 100644 --- a/examples/incident_detected.json +++ b/examples/incident_detected.json @@ -1,28 +1,28 @@ { "context": { - "version": "0.5.0-draft", - "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", - "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", - "source": "/monitoring/prod1", - "type": "dev.cdevents.incident.detected.0.3.0-draft", - "timestamp": "2022-11-11T13:52:20.079Z" + "version": "0.5.0-draft", + "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", + "source": "/monitoring/prod1", + "type": "dev.cdevents.incident.detected.0.3.0-draft", + "timestamp": "2022-11-11T13:52:20.079Z" }, "subject": { - "id": "incident-123", - "source": "/monitoring/prod1", - "type": "incident", - "content": { - "description": "Response time above threshold of 100ms", - "environment": { - "id": "prod1", - "source": "/iaas/geo1" - }, - "service": { - "id": "myApp", - "source": "/clusterA/namespaceB" - }, - "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427" - } + "id": "incident-123", + "source": "/monitoring/prod1", + "type": "incident", + "content": { + "description": "Response time above threshold of 100ms", + "environment": { + "id": "prod1", + "source": "/iaas/geo1" + }, + "service": { + "id": "myApp", + "source": "/clusterA/namespaceB" + }, + "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427" + } }, "customData": { "metric": "responseTime", diff --git a/examples/incident_reported.json b/examples/incident_reported.json index 5151f3bf..e439d0b3 100644 --- a/examples/incident_reported.json +++ b/examples/incident_reported.json @@ -1,29 +1,29 @@ { "context": { - "version": "0.5.0-draft", - "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", - "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", - "source": "/monitoring/prod1", - "type": "dev.cdevents.incident.reported.0.3.0-draft", - "timestamp": "2022-11-11T13:52:20.079Z" + "version": "0.5.0-draft", + "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", + "source": "/monitoring/prod1", + "type": "dev.cdevents.incident.reported.0.3.0-draft", + "timestamp": "2022-11-11T13:52:20.079Z" }, "subject": { - "id": "incident-123", - "source": "/monitoring/prod1", - "type": "incident", - "content": { - "description": "Response time above threshold of 100ms", - "environment": { - "id": "prod1", - "source": "/iaas/geo1" - }, - "service": { - "id": "myApp", - "source": "/clusterA/namespaceB" - }, - "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", - "ticketURI": "https://my-issues.example/incidents/ticket-345" - } + "id": "incident-123", + "source": "/monitoring/prod1", + "type": "incident", + "content": { + "description": "Response time above threshold of 100ms", + "environment": { + "id": "prod1", + "source": "/iaas/geo1" + }, + "service": { + "id": "myApp", + "source": "/clusterA/namespaceB" + }, + "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93427", + "ticketURI": "https://my-issues.example/incidents/ticket-345" + } }, "customData": { "severity": "medium", diff --git a/examples/incident_resolved.json b/examples/incident_resolved.json index ba311894..6cba3d9d 100644 --- a/examples/incident_resolved.json +++ b/examples/incident_resolved.json @@ -1,28 +1,28 @@ { "context": { - "version": "0.5.0-draft", - "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", - "chainId": "4c8cb7dd-3448-41de-8768-eec704e2829b", - "source": "/monitoring/prod1", - "type": "dev.cdevents.incident.resolved.0.3.0-draft", - "timestamp": "2022-11-11T13:52:20.079Z" + "version": "0.5.0-draft", + "id": "F4BD2B55-B6F6-4F44-AF72-BD2D0E7A8708", + "chain_id": "4c8cb7dd-3448-41de-8768-eec704e2829b", + "source": "/monitoring/prod1", + "type": "dev.cdevents.incident.resolved.0.3.0-draft", + "timestamp": "2022-11-11T13:52:20.079Z" }, "subject": { - "id": "incident-123", - "source": "/monitoring/prod1", - "type": "incident", - "content": { - "description": "Response time restored below 100ms", - "environment": { - "id": "prod1", - "source": "/iaas/geo1" - }, - "service": { - "id": "myApp", - "source": "/clusterA/namespaceB" - }, - "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93439" - } + "id": "incident-123", + "source": "/monitoring/prod1", + "type": "incident", + "content": { + "description": "Response time restored below 100ms", + "environment": { + "id": "prod1", + "source": "/iaas/geo1" + }, + "service": { + "id": "myApp", + "source": "/clusterA/namespaceB" + }, + "artifactId": "pkg:oci/myapp@sha256%3A0b31b1c02ff458ad9b7b81cbdf8f028bd54699fa151f221d1e8de6817db93439" + } }, "customData": { "metric": "responseTime", diff --git a/examples/testcaserun_finished.json b/examples/testcaserun_finished.json index 1073d717..f185df48 100644 --- a/examples/testcaserun_finished.json +++ b/examples/testcaserun_finished.json @@ -13,7 +13,7 @@ "source": "/event/source/123", "type": "testCaseRun", "content": { - "outcome" : "pass", + "outcome": "pass", "environment": { "id": "dev", "source": "testkube-dev-123" diff --git a/examples/testoutput_published.json b/examples/testoutput_published.json index c6e68da9..37c2baa1 100644 --- a/examples/testoutput_published.json +++ b/examples/testoutput_published.json @@ -13,8 +13,8 @@ "source": "/event/source/testrunreport-12123", "type": "testOutput", "content": { - "outputType" : "video", - "format" : "video/quicktime", + "outputType": "video", + "format": "video/quicktime", "testCaseRun": { "id": "myTestCaseRun123", "source": "testkube-dev-123" diff --git a/examples/testsuiterun_finished.json b/examples/testsuiterun_finished.json index ab26ff14..24bf1df7 100644 --- a/examples/testsuiterun_finished.json +++ b/examples/testsuiterun_finished.json @@ -13,9 +13,9 @@ "source": "/event/source/123", "type": "testSuiteRun", "content": { - "outcome" : "fail", - "severity" : "critical", - "reason" : "Host 123.34.23.32 not found", + "outcome": "fail", + "severity": "critical", + "reason": "Host 123.34.23.32 not found", "environment": { "id": "dev", "source": "testkube-dev-123" diff --git a/schemas/servicedeployed.json b/schemas/servicedeployed.json index a087d027..a070a1ab 100644 --- a/schemas/servicedeployed.json +++ b/schemas/servicedeployed.json @@ -117,8 +117,8 @@ "type": "object" }, { - "type": "string", - "contentEncoding": "base64" + "type": "string", + "contentEncoding": "base64" } ] },