MSP-6078 generate swagger
This commit is contained in:
1 parent
e55f5be9f1
commit
6aa1a77d4c
4 files changed
+332
-10
No files matched your search
+267
@@ -0,0 +1,267 @@
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/txix-open/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "GNU GPL v3.0"
|
||||
},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/script/batch_execute": {
|
||||
"post": {
|
||||
"description": "Возвращает результат выполнения скриптов и ошибок (если есть)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"script"
|
||||
],
|
||||
"summary": "Выполнить набор скриптов под конкретными ID",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Набор идентификаторов и аргументов",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/domain.ExecuteByIdRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/domain.ScriptResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/script/batch_execute_by_ids": {
|
||||
"post": {
|
||||
"description": "Возвращает результат выполнения скриптов и ошибок (если есть)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"script"
|
||||
],
|
||||
"summary": "Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Набор идентификаторов и единый аргумент",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/domain.BatchExecuteByIdsRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/domain.ScriptResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/script/execute": {
|
||||
"post": {
|
||||
"description": "Возвращает результат выполнения скрипта и ошибку (если есть)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"script"
|
||||
],
|
||||
"summary": "Выполнить скрипт без учёта идентификатора",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Скрипт необходимый к выполнению",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/domain.ExecuteRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/domain.ScriptResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/script/execute_by_id": {
|
||||
"post": {
|
||||
"description": "Возвращает результат выполнения скрипта и ошибку (если есть)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"script"
|
||||
],
|
||||
"summary": "Выполнить скрипт под конкретным ID",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "идентификатор скрипта",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/domain.ExecuteByIdRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/domain.ScriptResp"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/domain.GrpcError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"domain.BatchExecuteByIdsRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"ids"
|
||||
],
|
||||
"properties": {
|
||||
"arg": {},
|
||||
"ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.Error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ExecuteByIdRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id"
|
||||
],
|
||||
"properties": {
|
||||
"arg": {},
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ExecuteRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"script"
|
||||
],
|
||||
"properties": {
|
||||
"arg": {},
|
||||
"script": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.GrpcError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {}
|
||||
},
|
||||
"errorCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ScriptResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"$ref": "#/definitions/domain.Error"
|
||||
},
|
||||
"result": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0.0",
|
||||
Host: "localhost:9000",
|
||||
BasePath: "/api/script",
|
||||
Schemes: []string{},
|
||||
Title: "isp-script-service",
|
||||
Description: "Сервис для обработки и выполнения JavaScript скриптов",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
+5
-10
@@ -2,8 +2,7 @@ basePath: /api/script
|
||||
definitions:
|
||||
domain.BatchExecuteByIdsRequest:
|
||||
properties:
|
||||
arg:
|
||||
type: object
|
||||
arg: {}
|
||||
ids:
|
||||
items:
|
||||
type: string
|
||||
@@ -20,8 +19,7 @@ definitions:
|
||||
type: object
|
||||
domain.ExecuteByIdRequest:
|
||||
properties:
|
||||
arg:
|
||||
type: object
|
||||
arg: {}
|
||||
id:
|
||||
type: string
|
||||
required:
|
||||
@@ -29,8 +27,7 @@ definitions:
|
||||
type: object
|
||||
domain.ExecuteRequest:
|
||||
properties:
|
||||
arg:
|
||||
type: object
|
||||
arg: {}
|
||||
script:
|
||||
type: string
|
||||
required:
|
||||
@@ -39,8 +36,7 @@ definitions:
|
||||
domain.GrpcError:
|
||||
properties:
|
||||
details:
|
||||
items:
|
||||
type: object
|
||||
items: {}
|
||||
type: array
|
||||
errorCode:
|
||||
type: string
|
||||
@@ -51,8 +47,7 @@ definitions:
|
||||
properties:
|
||||
error:
|
||||
$ref: '#/definitions/domain.Error'
|
||||
result:
|
||||
type: object
|
||||
result: {}
|
||||
type: object
|
||||
host: localhost:9000
|
||||
info:
|
||||
|
||||
Reference in new issue
Block a user