go-clean-template
155 строк · 4.7 Кб
1{
2"swagger": "2.0",3"info": {4"description": "Using a translation service as an example",5"title": "Go Clean Template API",6"contact": {},7"version": "1.0"8},9"host": "localhost:8080",10"basePath": "/v1",11"paths": {12"/translation/do-translate": {13"post": {14"description": "Translate a text",15"consumes": [16"application/json"17],18"produces": [19"application/json"20],21"tags": [22"translation"23],24"summary": "Translate",25"operationId": "do-translate",26"parameters": [27{28"description": "Set up translation",29"name": "request",30"in": "body",31"required": true,32"schema": {33"$ref": "#/definitions/v1.doTranslateRequest"34}35}36],37"responses": {38"200": {39"description": "OK",40"schema": {41"$ref": "#/definitions/entity.Translation"42}43},44"400": {45"description": "Bad Request",46"schema": {47"$ref": "#/definitions/v1.response"48}49},50"500": {51"description": "Internal Server Error",52"schema": {53"$ref": "#/definitions/v1.response"54}55}56}57}58},59"/translation/history": {60"get": {61"description": "Show all translation history",62"consumes": [63"application/json"64],65"produces": [66"application/json"67],68"tags": [69"translation"70],71"summary": "Show history",72"operationId": "history",73"responses": {74"200": {75"description": "OK",76"schema": {77"$ref": "#/definitions/v1.historyResponse"78}79},80"500": {81"description": "Internal Server Error",82"schema": {83"$ref": "#/definitions/v1.response"84}85}86}87}88}89},90"definitions": {91"entity.Translation": {92"type": "object",93"properties": {94"destination": {95"type": "string",96"example": "en"97},98"original": {99"type": "string",100"example": "текст для перевода"101},102"source": {103"type": "string",104"example": "auto"105},106"translation": {107"type": "string",108"example": "text for translation"109}110}111},112"v1.doTranslateRequest": {113"type": "object",114"required": [115"destination",116"original",117"source"118],119"properties": {120"destination": {121"type": "string",122"example": "en"123},124"original": {125"type": "string",126"example": "текст для перевода"127},128"source": {129"type": "string",130"example": "auto"131}132}133},134"v1.historyResponse": {135"type": "object",136"properties": {137"history": {138"type": "array",139"items": {140"$ref": "#/definitions/entity.Translation"141}142}143}144},145"v1.response": {146"type": "object",147"properties": {148"error": {149"type": "string",150"example": "message"151}152}153}154}155}