Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate schemas and fix them accordingly #220

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: CDEvents
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches: [ main ]
branches: [ main, spec-v* ]

###############
# Set the Job #
Expand Down Expand Up @@ -33,20 +33,24 @@ jobs:
VALIDATE_MARKDOWN: true

jsonschema:
name: Validate Examples
name: Validate Schemas and Examples
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
go-version: 1.19

- name: Validate Examples
run: ./tools/verify-examples.sh
node-version: 20
cache: npm
cache-dependency-path: tools/package-lock.json
- name: Install dependencies
run: |
cd tools
npm install -g --no-fund ajv-cli ajv-formats
- name: Run Validate
run: ./tools/validate.sh

spellcheck:
name: Spellcheck (en_US)
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@

# Mac
.DS_Store

# JS
tools/node_modules
2 changes: 1 addition & 1 deletion schemas/artifactdeleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
afrittoli marked this conversation as resolved.
Show resolved Hide resolved
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/artifactdownloaded.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/artifactpackaged.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/artifactpublished.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/artifactsigned.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/branchcreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/branchdeleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/buildfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/buildqueued.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/buildstarted.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/changeabandoned.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/changecreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/changemerged.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/changereviewed.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/changeupdated.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/environmentcreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/environmentdeleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/environmentmodified.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/incidentdetected.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/incidentreported.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion schemas/incidentresolved.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minLength": 1
},
"links": {
"$ref": "/schema/links/embeddedlinksarray.json"
"$ref": "links/embeddedlinksarray"
}
},
"additionalProperties": false,
Expand Down
46 changes: 25 additions & 21 deletions schemas/links/embeddedlinkend.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
{
"link_type": {
"type": "string",
"enum": [
"END"
]
},
"from": {
"description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.",
"type": "object",
"properties": {
"context_id": {
"type": "string",
"minLength": 1
}
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://cdevents.dev/0.4.0/schema/links/embeddedlinkend",
afrittoli marked this conversation as resolved.
Show resolved Hide resolved
"properties": {
"link_type": {
"type": "string",
"enum": [
"END"
]
},
"required": [
"context_id"
]
},
"tags": {
"type": "object",
"additionalProperties": true
"from": {
"description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.",
"type": "object",
"properties": {
"context_id": {
"type": "string",
"minLength": 1
}
},
"required": [
"context_id"
]
},
"tags": {
"type": "object",
"additionalProperties": true
}
},
"additionalProperties": false,
"type": "object",
Expand Down
46 changes: 25 additions & 21 deletions schemas/links/embeddedlinkpath.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
{
"link_type": {
"type": "string",
"enum": [
"PATH"
]
},
"from": {
"description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.",
"type": "object",
"properties": {
"context_id": {
"type": "string",
"minLength": 1
}
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://cdevents.dev/0.4.0/schema/links/embeddedlinkpath",
"properties": {
"link_type": {
"type": "string",
"enum": [
"PATH"
]
},
"required": [
"context_id"
]
},
"tags": {
"type": "object",
"additionalProperties": true
"from": {
"description": "When consuming a CDEvent, you are consuming a parent event. So, when looking at the 'from' key, this is the parent's parent.",
"type": "object",
"properties": {
"context_id": {
"type": "string",
"minLength": 1
}
},
"required": [
"context_id"
]
},
"tags": {
"type": "object",
"additionalProperties": true
}
},
"additionalProperties": false,
"type": "object",
Expand Down
46 changes: 25 additions & 21 deletions schemas/links/embeddedlinkrelation.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{
"link_type": {
"type": "string",
"enum": [
"RELATION"
]
},
"link_kind": {
"type": "string",
"minLength": 1
},
"target": {
"description": "",
"type": "object",
"properties": {
"context_id": {
"type": "string",
"minLength": 1
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://cdevents.dev/0.4.0/schema/links/embeddedlinkrelation",
"properties": {
"link_type": {
"type": "string",
"enum": [
"RELATION"
]
},
"link_kind": {
"type": "string",
"minLength": 1
},
"target": {
"description": "",
"type": "object",
"properties": {
"context_id": {
"type": "string",
"minLength": 1
}
}
},
"tags": {
"type": "object",
"additionalProperties": true
}
},
"tags": {
"type": "object",
"additionalProperties": true
},
"additionalProperties": false,
"type": "object",
"required": [
Expand Down
Loading
Loading