From a4b511dfec6b54e4f5c193cc063a9c0160d10872 Mon Sep 17 00:00:00 2001 From: Wolfgang Werner Date: Sun, 2 Feb 2020 12:00:04 +0100 Subject: [PATCH 1/3] Describe validation, add incompatible definition --- vlingo-schemata-integration/README.adoc | 28 +++++++++++++++++++ .../main/vlingo/schemata/SchemaDefined2.vss | 5 ++++ 2 files changed, 33 insertions(+) create mode 100644 vlingo-schemata-integration/vlingo-schemata-producer/src/main/vlingo/schemata/SchemaDefined2.vss diff --git a/vlingo-schemata-integration/README.adoc b/vlingo-schemata-integration/README.adoc index 99986007..b4e8a800 100644 --- a/vlingo-schemata-integration/README.adoc +++ b/vlingo-schemata-integration/README.adoc @@ -106,6 +106,34 @@ NOTE: This is just for illustration purposes. Typically, you'll rely on maven's and not call `generate-sources` explicitly. Simply running `mvn install` will determine that `vlingo-build-plugin` is bound to `generate-sources` and run it before. +`vlingo/schemata` also provides a safety net to prevent you from publishing incompatible versions by +accident, so you won't break consumers of your published versions. +To emulate this, open the `SchemaDefined.vss` specification and make some incompatible changes, e.g. by changing +a type, reordering some fields and changing field names: + +.incompatible update to `SchemaDefined` see `src/main/vlingo/schemata/SchemaDefined` +``` +event SchemaDefined { + long occurredOn + version v + type t +} +``` + +In the producer project's pom, reference the updated file as a new patch version: +``` + + Vlingo:examples:io.vlingo.examples.schemata:SchemaDefined:0.0.2 <1> + SchemaDefined2.vss <2> + 0.0.1 <3> + +``` +<1> updated reference to new version +<2> use updated specification; this would normally be the same file +<3> specify the version the update is applied to + + + [[output-producer]] .producer build output diff --git a/vlingo-schemata-integration/vlingo-schemata-producer/src/main/vlingo/schemata/SchemaDefined2.vss b/vlingo-schemata-integration/vlingo-schemata-producer/src/main/vlingo/schemata/SchemaDefined2.vss new file mode 100644 index 00000000..b196f2ed --- /dev/null +++ b/vlingo-schemata-integration/vlingo-schemata-producer/src/main/vlingo/schemata/SchemaDefined2.vss @@ -0,0 +1,5 @@ +event SchemaDefined { + long occurredOn + version v + type t +} \ No newline at end of file From 2e0346ab05c58d983befad487e980f7485db8795 Mon Sep 17 00:00:00 2001 From: Wolfgang Werner Date: Sun, 2 Feb 2020 12:01:25 +0100 Subject: [PATCH 2/3] Add incompatible change to pom --- .../vlingo-schemata-producer/pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vlingo-schemata-integration/vlingo-schemata-producer/pom.xml b/vlingo-schemata-integration/vlingo-schemata-producer/pom.xml index 1ca8e874..df376d75 100644 --- a/vlingo-schemata-integration/vlingo-schemata-producer/pom.xml +++ b/vlingo-schemata-integration/vlingo-schemata-producer/pom.xml @@ -42,6 +42,14 @@ SchemaDefined.vss 0.0.0 + + Vlingo:examples:io.vlingo.examples.schemata:SchemaPublished:0.0.1 From 26ab59ce63ac11deb3e854099e51714ed88024b6 Mon Sep 17 00:00:00 2001 From: Wolfgang Werner Date: Sun, 2 Feb 2020 12:29:54 +0100 Subject: [PATCH 3/3] Update README --- vlingo-schemata-integration/README.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vlingo-schemata-integration/README.adoc b/vlingo-schemata-integration/README.adoc index b4e8a800..d395eb33 100644 --- a/vlingo-schemata-integration/README.adoc +++ b/vlingo-schemata-integration/README.adoc @@ -132,6 +132,13 @@ In the producer project's pom, reference the updated file as a new patch version <2> use updated specification; this would normally be the same file <3> specify the version the update is applied to +You'll notice that the build fails and presents you with a list of changes you have made. +Now you can either change the update to make it compatible or update the version to the next +major version `1.0.0`. + +So, by using the schema registry you not only have a way to integrate multiple bounded contexts +but are - as a consumer - safe from inadvertent upstream incompatibilities and, - as a publisher - +safe from accidentally pushing such updates.