fix swagger doc response model

This commit is contained in:
worldworm 2021-01-10 08:38:11 +00:00
parent 5c82f9e11e
commit eb832cc538

View file

@ -63,32 +63,30 @@ def create_app(char_limit=-1, req_limit=-1, ga_id=None, debug=False, frontend_la
responses: responses:
200: 200:
description: List of languages description: List of languages
content: schema:
application/json: id: languages
schema: type: array
type: array items:
items: type: object
type: object properties:
properties: code:
code: type: string
type: string description: Language code
description: Language code name:
name: type: string
type: string description: Human-readable language name (in English)
description: Human-readable language name (in English) charLimit:
charLimit: type: string
type: string description: Character input limit for this language (-1 indicates no limit)
description: Character input limit for this language (-1 indicates no limit)
429: 429:
description: Slow down description: Slow down
content: schema:
application/json: id: error-slow-down
schema: type: object
type: object properties:
properties: error:
error: type: string
type: string description: Reason for slow down
description: Reason for slow down
""" """
return jsonify([{'code': l.code, 'name': l.name, 'charLimit': char_limit } for l in languages]) return jsonify([{'code': l.code, 'name': l.name, 'charLimit': char_limit } for l in languages])
@ -136,44 +134,40 @@ def create_app(char_limit=-1, req_limit=-1, ga_id=None, debug=False, frontend_la
responses: responses:
200: 200:
description: Translated text description: Translated text
content: schema:
application/json: id: translate
schema: type: object
type: object properties:
properties: translatedText:
translatedText: type: string
type: string description: Translated text
description: Translated text
400: 400:
description: Invalid request description: Invalid request
content: schema:
application/json: id: error-response
schema: type: object
type: object properties:
properties: error:
error: type: string
type: string description: Error message
description: Error message
500: 500:
description: Translation error description: Translation error
content: schema:
application/json: id: error-response
schema: type: object
type: object properties:
properties: error:
error: type: string
type: string description: Error message
description: Error message
429: 429:
description: Slow down description: Slow down
content: schema:
application/json: id: error-slow-down
schema: type: object
type: object properties:
properties: error:
error: type: string
type: string description: Reason for slow down
description: Reason for slow down
""" """
if request.is_json: if request.is_json: