go-clean-template
105 строк · 2.4 Кб
1basePath: /v1
2definitions:
3entity.Translation:
4properties:
5destination:
6example: en
7type: string
8original:
9example: текст для перевода
10type: string
11source:
12example: auto
13type: string
14translation:
15example: text for translation
16type: string
17type: object
18v1.doTranslateRequest:
19properties:
20destination:
21example: en
22type: string
23original:
24example: текст для перевода
25type: string
26source:
27example: auto
28type: string
29required:
30- destination
31- original
32- source
33type: object
34v1.historyResponse:
35properties:
36history:
37items:
38$ref: '#/definitions/entity.Translation'
39type: array
40type: object
41v1.response:
42properties:
43error:
44example: message
45type: string
46type: object
47host: localhost:8080
48info:
49contact: {}
50description: Using a translation service as an example
51title: Go Clean Template API
52version: "1.0"
53paths:
54/translation/do-translate:
55post:
56consumes:
57- application/json
58description: Translate a text
59operationId: do-translate
60parameters:
61- description: Set up translation
62in: body
63name: request
64required: true
65schema:
66$ref: '#/definitions/v1.doTranslateRequest'
67produces:
68- application/json
69responses:
70"200":
71description: OK
72schema:
73$ref: '#/definitions/entity.Translation'
74"400":
75description: Bad Request
76schema:
77$ref: '#/definitions/v1.response'
78"500":
79description: Internal Server Error
80schema:
81$ref: '#/definitions/v1.response'
82summary: Translate
83tags:
84- translation
85/translation/history:
86get:
87consumes:
88- application/json
89description: Show all translation history
90operationId: history
91produces:
92- application/json
93responses:
94"200":
95description: OK
96schema:
97$ref: '#/definitions/v1.historyResponse'
98"500":
99description: Internal Server Error
100schema:
101$ref: '#/definitions/v1.response'
102summary: Show history
103tags:
104- translation
105swagger: "2.0"
106