...
- Deploy CPS Core new release (events form new schema are produced and still consumed as events from previous schema).
- Deploy CPS Temporal new release (event from new schema are produced and now consumed as events from new schema).
Changes
Schema versioning
Not having is own repository and being part of cps repository, cps-events Maven module is versioned each time cps repository is versioned. Then, having a cps-events Maven release does not means that the event schema is changed. It is possible that it is the exact same as the schema from previous cps-events release. Then, cps-events maven version can not be used to identify event schema version. Another versioning scheme is introduced to keep track of event schema versions. Following is the nomenclature for this versioning:
- v1
- v2
- v3
- ...
This version number is found in the Json event schema under the schema property.
In order for a given event instance to be produced by a previous event schema definition and read by a future event schema definition (backward compatibility), the schama version from the schema definition cannot be a constant anymore.
In order for a given event instance to be produced by a future event schema definition and still be read by a previous event schema definition (forward compatibility), the schema version from the schema definition cannot be an enum anymore.
Schema version in schema definition is then changed for a simple uri string.
Here are the changed proposed for event schema definition:
Code Block | ||||
---|---|---|---|---|
| ||||
--- a/cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json
+++ b/cps-events/src/main/resources/schemas/cps-data-updated-event-schema.json
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
- "$id": "urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT",
+ "$id": "urn:cps:org.onap.cps:data-updated-event-schema:v1",
"$ref": "#/definitions/CpsDataUpdatedEvent",
@@ -12,10 +12,9 @@
"type": "object",
"properties": {
"schema": {
- "description": "The schema, including its version, that this event adheres to.",
+ "description": "The schema, including its version, that this event adheres to. Ex: 'urn:cps:org.onap.cps:data-updated-event-schema:v1'.",
"type": "string",
- "default": "urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT",
- "enum": ["urn:cps:org.onap.cps:data-updated-event-schema:1.1.0-SNAPSHOT"]
+ "format": "uri"
},
"id": {
"description": "The unique id identifying the event for the specified source. Producer must ensure that source + id is unique for each distinct event.",
|
Reference note lo look at Jackson classes hierarchy for event classes: https://www.baeldung.com/jackson-inheritance