Skip to content

Instantly share code, notes, and snippets.

@tintoy
Created July 6, 2016 12:40
Show Gist options
  • Save tintoy/e0878e4681271e56add58757fe4fdbf9 to your computer and use it in GitHub Desktop.
Save tintoy/e0878e4681271e56add58757fe4fdbf9 to your computer and use it in GitHub Desktop.
Voting Schema
{
"$schema": "http://json-schema.org/schema#",
"title": "Polls API messsages",
"oneOf": [
{ "$ref": "#/definitions/PollCreated" },
{ "$ref": "#/definitions/PollUpdated" },
{ "$ref": "#/definitions/QuestionCreated" },
{ "$ref": "#/definitions/QuestionUpdated" },
{ "$ref": "#/definitions/ChoiceCreated" },
{ "$ref": "#/definitions/ChoiceUpdated" }
],
"definitions": {
"Message": {
"type": "object",
"properties": {
"$type": {
"type": "string"
},
"activityId": {
"type": "string",
"description": "The Id of the logical activity that the message is associated with."
}
},
"required": [
"$type",
"activityId"
]
},
"PollCreated": {
"type": "object",
"allOf": [
{ "$ref": "#/definitions/Message" }
],
"properties": {
"$type": {
"pattern": "PollCreated"
},
"id": {
"type": "integer",
"description": "The poll Id."
},
"name": {
"type": "string",
"description": "The poll name."
},
"created": {
"type": "string",
"description": "The ISO-formatted timestamp when the poll was created."
}
},
"required": [
"id",
"name",
"created"
]
},
"PollUpdated": {
"type": "object",
"allOf": [
{ "$ref": "#/definitions/Message" }
],
"properties": {
"$type": {
"pattern": "PollUpdated"
},
"id": {
"type": "integer",
"description": "The poll Id."
},
"name": {
"type": "string",
"description": "The poll name."
}
},
"required": [
"id",
"name"
]
},
"QuestionCreated": {
"type": "object",
"allOf": [
{ "$ref": "#/definitions/Message" }
],
"properties": {
"$type": {
"pattern": "QuestionCreated"
},
"id": {
"type": "integer",
"description": "The question Id."
},
"pollId": {
"type": "integer",
"description": "The Id of the poll that contains the question."
},
"text": {
"type": "string",
"description": "The question text."
},
"created": {
"type": "string",
"description": "The ISO-formatted timestamp when the question was created."
}
},
"required": [
"id",
"pollId",
"text",
"created"
]
},
"QuestionUpdated": {
"type": "object",
"allOf": [
{ "$ref": "#/definitions/Message" }
],
"properties": {
"$type": {
"pattern": "QuestionUpdated"
},
"id": {
"type": "integer",
"description": "The question Id."
},
"text": {
"type": "string",
"description": "The question text."
}
},
"required": [
"id",
"text"
]
},
"ChoiceCreated": {
"type": "object",
"allOf": [
{ "$ref": "#/definitions/Message" }
],
"properties": {
"$type": {
"pattern": "ChoiceCreated"
},
"id": {
"type": "integer",
"description": "The choice Id."
},
"questionId": {
"type": "integer",
"description": "The Id of the question that choice applies to."
},
"text": {
"type": "string",
"description": "The choice text."
},
"created": {
"type": "string",
"description": "The ISO-formatted timestamp when the choice was created."
}
},
"required": [
"id",
"questionId",
"text",
"created"
]
},
"ChoiceUpdated": {
"type": "object",
"allOf": [
{ "$ref": "#/definitions/Message" }
],
"properties": {
"$type": {
"pattern": "ChoiceUpdated"
},
"id": {
"type": "integer",
"description": "The choice Id."
},
"text": {
"type": "string",
"description": "The choice text."
}
},
"required": [
"id",
"text"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment