Added Swagger Documentation
- Added Swagger Docs (generated docs in ./docs folder; ) - Added .golangci.yml config file
This commit is contained in:
1 parent
68e1f0d094
commit
9ccc1c1728
6 files changed
+796
-4
No files matched your search
@@ -0,0 +1,37 @@
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- goimports
|
||||
- depguard # не используется
|
||||
- gochecknoinits
|
||||
- gochecknoglobals
|
||||
- wsl
|
||||
- gocognit
|
||||
- godox # находит тудушки, не нужно
|
||||
- golint # подумать, может вернуть
|
||||
- stylecheck # подумать, может вернуть
|
||||
|
||||
linters-settings:
|
||||
maligned:
|
||||
suggest-new: true
|
||||
lll:
|
||||
line-length: 140
|
||||
tab-width: 1
|
||||
funlen:
|
||||
lines: 80
|
||||
statements: 40
|
||||
prealloc:
|
||||
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
|
||||
# True by default.
|
||||
simple: true
|
||||
range-loops: true # Report preallocation suggestions on range loops, true by default
|
||||
for-loops: true # Report preallocation suggestions on for loops, false by default
|
||||
gocritic:
|
||||
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
|
||||
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- performance
|
||||
settings:
|
||||
hugeParam:
|
||||
sizeThreshold: 90
|
||||
@@ -9,18 +9,55 @@ var Script scriptController
|
||||
|
||||
type scriptController struct{}
|
||||
|
||||
// ExecuteById godoc
|
||||
// @Tags script
|
||||
// @Summary Выполнить скрипт под конкректным ID
|
||||
// @Description Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ExecuteByIdRequest true "Идентифиактор скрипта"
|
||||
// @Success 200 {object} domain.ScriptResp
|
||||
// @Failure 404 {object} structure.GrpcError
|
||||
// @Router /script/execute_by_id [POST]
|
||||
func (c scriptController) ExecuteById(req domain.ExecuteByIdRequest) (*domain.ScriptResp, error) {
|
||||
return service.Script.ExecuteById(req)
|
||||
}
|
||||
|
||||
// Execute godoc
|
||||
// @Tags script
|
||||
// @Summary Выполнить скрипт без учёта идентификатора
|
||||
// @Description Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ExecuteRequest true "Скрипт необходимый к выполнению"
|
||||
// @Success 200 {object} domain.ScriptResp
|
||||
// @Router /script/execute [POST]
|
||||
func (c scriptController) Execute(req domain.ExecuteRequest) *domain.ScriptResp {
|
||||
return service.Script.Execute(req)
|
||||
}
|
||||
|
||||
// BatchExecute godoc
|
||||
// @Tags script
|
||||
// @Summary Выполнить набор скриптов под конкретными ID
|
||||
// @Description Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []domain.ExecuteByIdRequest true "Набор идентфикаторов и аргументов"
|
||||
// @Success 200 {array} domain.ScriptResp
|
||||
// @Router /script/batch_execute [POST]
|
||||
func (c scriptController) BatchExecute(req []domain.ExecuteByIdRequest) []domain.ScriptResp {
|
||||
return service.Script.BatchExecute(req)
|
||||
}
|
||||
|
||||
// BatchExecuteById godoc
|
||||
// @Tags script
|
||||
// @Summary Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех
|
||||
// @Description Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.BatchExecuteByIdsRequest true "Набор идентфикаторов и единый аргумент"
|
||||
// @Success 200 {array} domain.ScriptResp
|
||||
// @Router /script/batch_execute_by_ids [POST]
|
||||
func (c scriptController) BatchExecuteById(req domain.BatchExecuteByIdsRequest) []domain.ScriptResp {
|
||||
return service.Script.BatchExecuteById(req)
|
||||
}
|
||||
+306
@@ -0,0 +1,306 @@
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
|
||||
package docs
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/template"
|
||||
"github.com/swaggo/swag"
|
||||
)
|
||||
|
||||
var doc = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{.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/structure.GrpcError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"domain.BatchExecuteByIdsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arg": {
|
||||
"type": "object"
|
||||
},
|
||||
"ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.Error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ExecuteByIdRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arg": {
|
||||
"type": "object"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ExecuteRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arg": {
|
||||
"type": "object"
|
||||
},
|
||||
"script": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ScriptResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"$ref": "#/definitions/domain.Error"
|
||||
},
|
||||
"result": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"structure.GrpcError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"errorCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
type swaggerInfo struct {
|
||||
Version string
|
||||
Host string
|
||||
BasePath string
|
||||
Schemes []string
|
||||
Title string
|
||||
Description string
|
||||
}
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = swaggerInfo{
|
||||
Version: "1.0.0",
|
||||
Host: "localhost:9024",
|
||||
BasePath: "/api/script",
|
||||
Schemes: []string{},
|
||||
Title: "isp-script-service",
|
||||
Description: "{описание сервиса}",
|
||||
}
|
||||
|
||||
type s struct{}
|
||||
|
||||
func (s *s) ReadDoc() string {
|
||||
sInfo := SwaggerInfo
|
||||
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
|
||||
|
||||
t, err := template.New("swagger_info").Funcs(template.FuncMap{
|
||||
"marshal": func(v interface{}) string {
|
||||
a, _ := json.Marshal(v)
|
||||
return string(a)
|
||||
},
|
||||
}).Parse(doc)
|
||||
if err != nil {
|
||||
return doc
|
||||
}
|
||||
|
||||
var tpl bytes.Buffer
|
||||
if err := t.Execute(&tpl, sInfo); err != nil {
|
||||
return doc
|
||||
}
|
||||
|
||||
return tpl.String()
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(swag.Name, &s{})
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{описание сервиса}",
|
||||
"title": "isp-script-service",
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "GNU GPL v3.0"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"host": "localhost:9024",
|
||||
"basePath": "/api/script",
|
||||
"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/structure.GrpcError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"domain.BatchExecuteByIdsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arg": {
|
||||
"type": "object"
|
||||
},
|
||||
"ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.Error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ExecuteByIdRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arg": {
|
||||
"type": "object"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ExecuteRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"arg": {
|
||||
"type": "object"
|
||||
},
|
||||
"script": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"domain.ScriptResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"$ref": "#/definitions/domain.Error"
|
||||
},
|
||||
"result": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"structure.GrpcError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"errorCode": {
|
||||
"type": "string"
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
basePath: /api/script
|
||||
definitions:
|
||||
domain.BatchExecuteByIdsRequest:
|
||||
properties:
|
||||
arg:
|
||||
type: object
|
||||
ids:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
domain.Error:
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
type: object
|
||||
domain.ExecuteByIdRequest:
|
||||
properties:
|
||||
arg:
|
||||
type: object
|
||||
id:
|
||||
type: string
|
||||
type: object
|
||||
domain.ExecuteRequest:
|
||||
properties:
|
||||
arg:
|
||||
type: object
|
||||
script:
|
||||
type: string
|
||||
type: object
|
||||
domain.ScriptResp:
|
||||
properties:
|
||||
error:
|
||||
$ref: '#/definitions/domain.Error'
|
||||
result:
|
||||
type: object
|
||||
type: object
|
||||
structure.GrpcError:
|
||||
properties:
|
||||
details:
|
||||
items:
|
||||
type: object
|
||||
type: array
|
||||
errorCode:
|
||||
type: string
|
||||
errorMessage:
|
||||
type: string
|
||||
type: object
|
||||
host: localhost:9024
|
||||
info:
|
||||
contact: {}
|
||||
description: '{описание сервиса}'
|
||||
license:
|
||||
name: GNU GPL v3.0
|
||||
title: isp-script-service
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/script/batch_execute:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||
parameters:
|
||||
- description: Набор идентфикаторов и аргументов
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/domain.ExecuteByIdRequest'
|
||||
type: array
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/domain.ScriptResp'
|
||||
type: array
|
||||
summary: Выполнить набор скриптов под конкретными ID
|
||||
tags:
|
||||
- script
|
||||
/script/batch_execute_by_ids:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Возвращает результат выполнения скриптов и ошибок (если есть)
|
||||
parameters:
|
||||
- description: Набор идентфикаторов и единый аргумент
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/domain.BatchExecuteByIdsRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/domain.ScriptResp'
|
||||
type: array
|
||||
summary: Выполнить набор скриптов под конкретными ID с идентичным аргументом для всех
|
||||
tags:
|
||||
- script
|
||||
/script/execute:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||
parameters:
|
||||
- description: Скрипт необходимый к выполнению
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/domain.ExecuteRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/domain.ScriptResp'
|
||||
summary: Выполнить скрипт без учёта идентификатора
|
||||
tags:
|
||||
- script
|
||||
/script/execute_by_id:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Возвращает результат выполнения скрипта и ошибку (если есть)
|
||||
parameters:
|
||||
- description: Идентифиактор скрипта
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/domain.ExecuteByIdRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/domain.ScriptResp'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/structure.GrpcError'
|
||||
summary: Выполнить скрипт под конкректным ID
|
||||
tags:
|
||||
- script
|
||||
swagger: "2.0"
|
||||
@@ -4,6 +4,11 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"isp-script-service/conf"
|
||||
"isp-script-service/helper"
|
||||
"isp-script-service/router"
|
||||
"isp-script-service/service"
|
||||
|
||||
"github.com/integration-system/isp-lib/v2/backend"
|
||||
"github.com/integration-system/isp-lib/v2/bootstrap"
|
||||
"github.com/integration-system/isp-lib/v2/config/schema"
|
||||
@@ -12,16 +17,21 @@ import (
|
||||
log "github.com/integration-system/isp-log"
|
||||
"github.com/integration-system/isp-log/stdcodes"
|
||||
"google.golang.org/grpc"
|
||||
"isp-script-service/conf"
|
||||
"isp-script-service/helper"
|
||||
"isp-script-service/router"
|
||||
"isp-script-service/service"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "1.0.0"
|
||||
)
|
||||
|
||||
// @title isp-script-service
|
||||
// @version 1.0.0
|
||||
// @description Сервис для обработка и выполения JavaScript скриптов
|
||||
|
||||
// @license.name GNU GPL v3.0
|
||||
|
||||
// @host localhost:9024
|
||||
// @BasePath /api/script
|
||||
|
||||
func main() {
|
||||
bootstrap.
|
||||
ServiceBootstrap(&conf.Configuration{}, &conf.RemoteConfig{}).
|
||||
|
||||
Reference in new issue
Block a user