Created
March 3, 2018 12:41
-
-
Save foxel/baea1b1dd923f32e837c472f778b7b30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"definitions": { | |
"CreateDocumentCommand": { | |
"type": "object", | |
"required": ["eventType", "documentName"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["CreateDocument"] | |
}, | |
"documentName": { | |
"type": "string" | |
} | |
} | |
}, | |
"OpenDocumentCommand": { | |
"type": "object", | |
"required": ["eventType", "documentId"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["OpenDocument"] | |
}, | |
"documentId": { | |
"$ref": "#/definitions/DocumentId" | |
} | |
} | |
}, | |
"DocumentOpenedResponse": { | |
"type": "object", | |
"required": ["eventType", "document", "chatHistory"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["DocumentOpened"] | |
}, | |
"document": { | |
"$ref": "#/definitions/Document" | |
}, | |
"chatHistory": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/ChatMessage" | |
} | |
} | |
} | |
}, | |
"DocumentOpenError": { | |
"type": "object", | |
"required": ["eventType", "code"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["OpenError"] | |
}, | |
"code": { | |
"type": "string" | |
}, | |
"reason": { | |
"type": "string" | |
} | |
} | |
}, | |
"ChangeUserNameCommand": { | |
"type": "object", | |
"required": ["eventType", "name"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["SetUserName"] | |
}, | |
"name": { | |
"type": "string" | |
} | |
} | |
}, | |
"PostChatMessageCommand": { | |
"type": "object", | |
"required": ["eventType", "message"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["PostChatMessage"] | |
}, | |
"message": { | |
"type": "string" | |
} | |
} | |
}, | |
"NewChatMessageEvent": { | |
"type": "object", | |
"required": ["eventType", "message"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["NewChatMessage"] | |
}, | |
"message": { | |
"$ref": "#/definitions/ChatMessage" | |
} | |
} | |
}, | |
"ChatHistoryRefreshEvent": { | |
"type": "object", | |
"required": ["eventType", "chatHistory"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["ChatHistoryRefresh"] | |
}, | |
"chatHistory": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/ChatMessage" | |
} | |
} | |
} | |
}, | |
"UpdateDocumentCommand": { | |
"type": "object", | |
"required": ["eventType", "name", "text", "versionId", "referenceId"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["UpdateDocument"] | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"text": { | |
"type": "string" | |
}, | |
"versionId": { | |
"description": "old version ID", | |
"type": "integer" | |
}, | |
"referenceId": { | |
"description": "to be used in response", | |
"type": "string" | |
} | |
} | |
}, | |
"DocumentUpdatedEvent": { | |
"type": "object", | |
"required": ["eventType", "document"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["DocumentUpdated"] | |
}, | |
"document": { | |
"$ref": "#/definitions/Document" | |
} | |
} | |
}, | |
"DocumentUpdateError": { | |
"type": "object", | |
"required": ["eventType", "code", "referenceId"], | |
"properties": { | |
"eventType": { | |
"type": "string", | |
"enum": ["UpdateError"] | |
}, | |
"code": { | |
"type": "string" | |
}, | |
"reason": { | |
"type": "string" | |
}, | |
"referenceId": { | |
"description": "reference to update request", | |
"type": "string" | |
} | |
} | |
}, | |
"ChatMessage": { | |
"type": "object", | |
"required": [], | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"author": { | |
"type": "string" | |
}, | |
"text": { | |
"type": "string" | |
}, | |
"timestamp": { | |
"type": "string", | |
"format": "date-time" | |
} | |
} | |
}, | |
"Document": { | |
"type": "object", | |
"required": ["id", "name", "text", "versionId"], | |
"properties": { | |
"id": { | |
"$ref": "#/definitions/DocumentId" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"text": { | |
"type": "string" | |
}, | |
"versionId": { | |
"type": "integer" | |
} | |
} | |
}, | |
"DocumentId": { | |
"type": "string", | |
"pattern": "/^\\w+$/" | |
} | |
}, | |
"oneOf": [ | |
{"$ref": "#/definitions/CreateDocumentCommand"}, | |
{"$ref": "#/definitions/OpenDocumentCommand"}, | |
{"$ref": "#/definitions/DocumentOpenedResponse"}, | |
{"$ref": "#/definitions/DocumentOpenError"}, | |
{"$ref": "#/definitions/ChangeUserNameCommand"}, | |
{"$ref": "#/definitions/PostChatMessageCommand"}, | |
{"$ref": "#/definitions/NewChatMessageEvent"}, | |
{"$ref": "#/definitions/ChatHistoryRefreshEvent"}, | |
{"$ref": "#/definitions/UpdateDocumentCommand"}, | |
{"$ref": "#/definitions/DocumentUpdatedEvent"}, | |
{"$ref": "#/definitions/DocumentUpdateError"} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment