From d56ec79dd980bcf773ba6a72e5c76d4e45b3936d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20Gonz=C3=A1lez?= Date: Tue, 23 May 2017 15:50:26 -0700 Subject: [PATCH] docs: Create JsonSuccess and JsonError definitions. --- static/yaml/zulip.yaml | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/static/yaml/zulip.yaml b/static/yaml/zulip.yaml index b0a3c259d0..4ec36c5e30 100644 --- a/static/yaml/zulip.yaml +++ b/static/yaml/zulip.yaml @@ -412,22 +412,11 @@ paths: '200': description: Success schema: - type: object - required: - - msg - - result - properties: - msg: - type: string - result: - type: string + $ref: '#/definitions/JsonSuccess' '400': description: Bad request. schema: - type: object - required: - - msg - - result + $ref: '#/definitions/JsonError' properties: msg: type: string @@ -459,6 +448,29 @@ securityDefinitions: #################### # Shared definitions definitions: + JsonResponse: + type: object + properties: + msg: + type: string + required: true + result: + type: string + required: true + + JsonSuccess: + allOf: + - $ref: '#/definitions/JsonResponse' + properties: + msg: + default: success + + JsonError: + allOf: + - $ref: '#/definitions/JsonResponse' + properties: + msg: + default: error # /messages MessageResponse: