diff --git a/vlingo-schemata-integration/README.adoc b/vlingo-schemata-integration/README.adoc index 0c62c373..f351de82 100644 --- a/vlingo-schemata-integration/README.adoc +++ b/vlingo-schemata-integration/README.adoc @@ -18,8 +18,16 @@ you can also interact with schemata as part of your build process. In projects, you'll typically consume and/or publish schemata to be able to integrate with other bounded contexts in a type safe and versioned manner. -This example contains of one project publishing schemata and another one -consuming them as part of their maven build. +In this example, you'll see how to ... + +* ... build an run `vlingo/schemata` +* ... manage schemata and schemata meta data using the UI and the HTTP API. +* ... push schemata to the registry from maven builds and +* ... consume schemata stored in the registry as part of the build. + + +NOTE: This is the first iteration of the example. We're already working on updates showing +version validation and the schemata lifecycle. == Prerequisites @@ -72,8 +80,9 @@ image::doc/ui-browse.png[] ==== Using the API -In case you are using IntelliJ, you can just run the requests in `masterdata.http` directly. -Otherwise, deriving the `curl` footnote:[`PostMan`, `HTTPie`, `wget`, pick your flavor.] +In case you are using IntelliJ, you can just run the requests in `masterdata.http` directly; +`masterdata.sh` is a bash script doing the same footnote:[Requires `curl` and `jq`]. +Otherwise, deriving the `wget` footnote:[`PostMan`, `HTTPie`, `Insomnia`, `Invoke-WebRequest` pick your flavor.] calls from the snippets should be a simple exercise. == Run @@ -97,7 +106,6 @@ NOTE: This is just for illustration purposes. Typically, you'll rely on maven's that `vlingo-build-plugin` is bound to `generate-sources` and run it before. - [[output-producer]] .producer build output [source] diff --git a/vlingo-schemata-integration/masterdata.sh b/vlingo-schemata-integration/masterdata.sh new file mode 100755 index 00000000..f15f0b52 --- /dev/null +++ b/vlingo-schemata-integration/masterdata.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Small utility script to add master data required for the example to a schemata instance +# Requires curl and jq to be on the path. +# Set the port to the port the schemata server is listening on + +PORT=9039 +ORG_ID=$(curl -s -d '{ "organizationId": "", "name": "Vlingo", "description": "Vlingo Organization" }' -H 'Content-Type: application/json' -X POST http://localhost:${PORT}/organizations | jq -r '.organizationId') +UNIT_ID=$(curl -s -d '{ "organizationId": "'${ORG_ID}'", "unitId": "", "name": "examples", "description": "Examples for vlingo/schemata" }' -X POST -H 'Content-Type: application/json' http://localhost:${PORT}/organizations/${ORG_ID}/units | jq -r '.unitId') +CONTEXT_ID=$(curl -s -X POST -H 'Content-Type: application/json' -d '{ "organizationId": "'${ORG_ID}'", "unitId": "'${UNIT_ID}'", "contextId": "", "namespace": "io.vlingo.examples.schemata", "description": "Bounded context for vlingo/schemata examples" }' http://localhost:${PORT}/organizations/${ORG_ID}/units/${UNIT_ID}/contexts | jq -r '.contextId') +curl -s -X POST -H 'Content-Type: application/json' -d '{ "organizationId": "'${ORG_ID}'", "unitId": "'${UNIT_ID}'", "contextId": "'${CONTEXT_ID}'", "schemaId": "", "category": "Event", "name": "SchemaDefined", "scope": "Public", "description": "Fired whenever a new schema is defined." }' http://localhost:${PORT}/organizations/${ORG_ID}/units/${UNIT_ID}/contexts/${CONTEXT_ID}/schemas +curl -s -X POST -H 'Content-Type: application/json' -d '{ "organizationId": "'${ORG_ID}'", "unitId": "'${UNIT_ID}'", "contextId": "'${CONTEXT_ID}'", "schemaId": "", "category": "Event", "name": "SchemaPublished", "scope": "Public", "description": "Fired whenever a schema version is published." }' http://localhost:${PORT}/organizations/${ORG_ID}/units/${UNIT_ID}/contexts/${CONTEXT_ID}/schemas