Skip to content

Instantly share code, notes, and snippets.

@larribas
Created May 26, 2016 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larribas/9d1d448bdc3b0e7beaa9021198426aaf to your computer and use it in GitHub Desktop.
Save larribas/9d1d448bdc3b0e7beaa9021198426aaf to your computer and use it in GitHub Desktop.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Event",
"description": "Shared schema for domain events",
"properties": {
"data": {
"description": "Arbitrary data detailing the event",
"type": "object"
},
"id": {
"description": "The event's UUID",
"type": "string"
},
"time": {
"description": "An explanation about the purpose of this instance.",
"title": "Time schema.",
"type": "string",
"format": "date-time"
},
"type": {
"description": "The event's type",
"type": "string"
},
"version": {
"description": "The version of the domain unit described by this event",
"type": "integer"
}
},
"required": [
"id",
"type",
"time",
"version",
"data"
],
"type": "object"
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Event: user_changed_name",
"description": "Event that occurs when a user changes his/her name",
"properties": {
"meta": {
"$ref": "event.json",
"type": {
"type": "string",
"pattern": "^user_changed_name$"
}
},
"data": {
"properties": {
"id": {
"description": "The UUID given to the user",
"type": "string"
},
"name": {
"description": "The user's complete name",
"type": "string"
}
},
"required": [
"id",
"name"
],
"type": "object"
}
},
"type": "object"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment