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

Remove the version enums from schemas #90

Merged
merged 1 commit into from
Nov 17, 2022
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
8 changes: 8 additions & 0 deletions primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@ format `vMajor.Minor.Patch`.
While a version of the specification is work in progress, its version is tagged
with an extra `-draft` at the end, for instance 0.1.0-draft.

The version is in each schema as part of the schema id and it's included in
each event in the "version" field. The version field does not include enum nor
default values in the schema because that would require changing the event
version every time the spec version is changed. Examples:

- Schema: `"$id": "https://cdevents.dev/0.1.1/schema/artifact-packaged-event",`
- Event: `"version": "0.1.1"`

### Development of a new version

The specification on the main branch is versioned with the number of the next
Expand Down
6 changes: 1 addition & 5 deletions schemas/artifactpackaged.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the "0.1.1" reference in the $id field above? That also needs to be changed if we shouldn't need to update all schema files for each event version, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "$id" field has no impact on the schema itself, it's only an URL from where the schema can be fetched.
My feeling is that when a new spec version is made, new ids are created, but the ids for a specific message will return the exact same schema (except for the id) if the new spec didn't introduce a change for that event.

For instance, the following two IDs:

May return a schema for the same event - i.e. "dev.cdevents.artifact.packaged.0.1.0".
After this PR I will add a PR which adds the event type as a default value in the schema, which will make this more clear from just looking at the schema.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid I don't follow completely. These $id's still confuse me...
You're saying that we don't need to update each event schema when we define a new spec version? So, if e.g. artifact.packaged is updated to event version 0.1.1 in spec version 0.1.2, and not updated for spec version 0.1.3, the schema for artfact.packaged will not be changed and still have this $id: https://cdevents.dev/0.1.2/schema/artifact-packaged-event?
I assume we will still deploy the schema for artifact.packaged on 0.1.3, but the result when fetching if for 0.1.2 and 0.1.3 will be identical, including the $id field in that schema retrieved (pointing at spec version 0.1.2 for both)?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is exactly what Andrea meant. If an event definition has not changed, we will just "deploy" the same definition to the new spec version location (so 0.1.2 and 0.1.3 will point to identical definitions but on different URLs.)

"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/artifactpublished.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/branchcreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/branchdeleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/buildfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/buildqueued.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/buildstarted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/changeabandoned.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/changecreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/changemerged.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/changereviewed.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
5 changes: 1 addition & 4 deletions schemas/changeupdated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/environmentcreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/environmentdeleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/environmentmodified.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/pipelinerunfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/pipelinerunqueued.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/pipelinerunstarted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/repositorycreated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/repositorydeleted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/repositorymodified.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/servicedeployed.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/servicepublished.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/serviceremoved.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/servicerolledback.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/serviceupgraded.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/taskrunfinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/taskrunstarted.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/testcasefinished.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
6 changes: 1 addition & 5 deletions schemas/testcasequeued.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
"properties": {
"version": {
"type": "string",
"enum": [
"0.1.0",
"0.1.1"
],
"default": "0.1.1"
"minLength": 1
},
"id": {
"type": "string",
Expand Down
Loading