mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-09 00:00:00 +01:00
Merge branch 'fix-error-apispec' into 'master'
Fix error in OpenAPI spec generated by swag See merge request acs/public/villas/web-backend-go!51
This commit is contained in:
commit
635d103f17
7 changed files with 122 additions and 83 deletions
|
@ -60,7 +60,7 @@ test:
|
|||
- mc mb gitlab/${S3_BUCKET}
|
||||
script:
|
||||
- go mod tidy
|
||||
- go get github.com/swaggo/swag/cmd/swag@v1.7.0
|
||||
- go get github.com/swaggo/swag/cmd/swag@v1.8.1
|
||||
- go install github.com/swaggo/swag/cmd/swag
|
||||
- ${GOPATH}/bin/swag init --propertyStrategy pascalcase
|
||||
--generalInfo "start.go"
|
||||
|
|
|
@ -6,7 +6,7 @@ WORKDIR /build
|
|||
# Make use of layer caching
|
||||
ADD go.* ./
|
||||
RUN go mod download
|
||||
RUN go install github.com/swaggo/swag/cmd/swag@v1.7.0
|
||||
RUN go install github.com/swaggo/swag/cmd/swag@v1.8.1
|
||||
|
||||
ADD . .
|
||||
|
||||
|
|
111
doc/api/docs.go
111
doc/api/docs.go
|
@ -1,22 +1,14 @@
|
|||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Package api GENERATED BY SWAG; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
"github.com/alecthomas/template"
|
||||
"github.com/swaggo/swag"
|
||||
)
|
||||
|
||||
var doc = `{
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{.Description}}",
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {
|
||||
"name": "Institute for Automation of Complex Power Systems, RWTH Aachen University"
|
||||
|
@ -1843,7 +1835,8 @@ var doc = `{
|
|||
"application/zip",
|
||||
"application/msexcel",
|
||||
"application/xml",
|
||||
"application/x-bag"
|
||||
"application/x-bag",
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
|
@ -3793,7 +3786,11 @@ var doc = `{
|
|||
"type": "integer"
|
||||
},
|
||||
"Direction": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"in",
|
||||
"out"
|
||||
]
|
||||
},
|
||||
"Index": {
|
||||
"type": "integer"
|
||||
|
@ -3870,13 +3867,20 @@ var doc = `{
|
|||
"type": "string"
|
||||
},
|
||||
"Password": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 6
|
||||
},
|
||||
"Role": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Admin",
|
||||
"User",
|
||||
"Guest"
|
||||
]
|
||||
},
|
||||
"Username": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -3884,22 +3888,34 @@ var doc = `{
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"Active": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"yes",
|
||||
"no"
|
||||
]
|
||||
},
|
||||
"Mail": {
|
||||
"type": "string"
|
||||
},
|
||||
"OldPassword": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 6
|
||||
},
|
||||
"Password": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 6
|
||||
},
|
||||
"Role": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Admin",
|
||||
"User",
|
||||
"Guest"
|
||||
]
|
||||
},
|
||||
"Username": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -4026,49 +4042,18 @@ var doc = `{
|
|||
}
|
||||
}`
|
||||
|
||||
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: "2.0",
|
||||
Host: "",
|
||||
BasePath: "/api/v2",
|
||||
Schemes: []string{},
|
||||
Title: "VILLASweb Backend API",
|
||||
Description: "This is the [VILLASweb Backend](https://git.rwth-aachen.de/acs/public/villas/web-backend-go) API v2.0.\nThis documentation is auto-generated based on the API documentation in the code. The tool [swag](https://github.com/swaggo/swag) is used to auto-generate API docs for the [gin-gonic](https://github.com/gin-gonic/gin) framework.\nAuthentication: Use the authenticate endpoint below to obtain a token for your user account, copy the token into to the value field of the dialog showing up for the green Authorize button below and confirm with Done.",
|
||||
}
|
||||
|
||||
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()
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "2.0",
|
||||
Host: "",
|
||||
BasePath: "/api/v2",
|
||||
Schemes: []string{},
|
||||
Title: "VILLASweb Backend API",
|
||||
Description: "This is the [VILLASweb Backend](https://git.rwth-aachen.de/acs/public/villas/web-backend-go) API v2.0.\nThis documentation is auto-generated based on the API documentation in the code. The tool [swag](https://github.com/swaggo/swag) is used to auto-generate API docs for the [gin-gonic](https://github.com/gin-gonic/gin) framework.\nAuthentication: Use the authenticate endpoint below to obtain a token for your user account, copy the token into to the value field of the dialog showing up for the green Authorize button below and confirm with Done.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(swag.Name, &s{})
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
|
|
|
@ -1827,7 +1827,8 @@
|
|||
"application/zip",
|
||||
"application/msexcel",
|
||||
"application/xml",
|
||||
"application/x-bag"
|
||||
"application/x-bag",
|
||||
"multipart/form-data"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
|
@ -3777,7 +3778,11 @@
|
|||
"type": "integer"
|
||||
},
|
||||
"Direction": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"in",
|
||||
"out"
|
||||
]
|
||||
},
|
||||
"Index": {
|
||||
"type": "integer"
|
||||
|
@ -3854,13 +3859,20 @@
|
|||
"type": "string"
|
||||
},
|
||||
"Password": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 6
|
||||
},
|
||||
"Role": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Admin",
|
||||
"User",
|
||||
"Guest"
|
||||
]
|
||||
},
|
||||
"Username": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -3868,22 +3880,34 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"Active": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"yes",
|
||||
"no"
|
||||
]
|
||||
},
|
||||
"Mail": {
|
||||
"type": "string"
|
||||
},
|
||||
"OldPassword": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 6
|
||||
},
|
||||
"Password": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 6
|
||||
},
|
||||
"Role": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Admin",
|
||||
"User",
|
||||
"Guest"
|
||||
]
|
||||
},
|
||||
"Username": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"minLength": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -328,6 +328,9 @@ definitions:
|
|||
ConfigID:
|
||||
type: integer
|
||||
Direction:
|
||||
enum:
|
||||
- in
|
||||
- out
|
||||
type: string
|
||||
Index:
|
||||
type: integer
|
||||
|
@ -379,10 +382,16 @@ definitions:
|
|||
Mail:
|
||||
type: string
|
||||
Password:
|
||||
minLength: 6
|
||||
type: string
|
||||
Role:
|
||||
enum:
|
||||
- Admin
|
||||
- User
|
||||
- Guest
|
||||
type: string
|
||||
Username:
|
||||
minLength: 3
|
||||
type: string
|
||||
required:
|
||||
- Mail
|
||||
|
@ -393,16 +402,26 @@ definitions:
|
|||
user.validUpdatedRequest:
|
||||
properties:
|
||||
Active:
|
||||
enum:
|
||||
- "yes"
|
||||
- "no"
|
||||
type: string
|
||||
Mail:
|
||||
type: string
|
||||
OldPassword:
|
||||
minLength: 6
|
||||
type: string
|
||||
Password:
|
||||
minLength: 6
|
||||
type: string
|
||||
Role:
|
||||
enum:
|
||||
- Admin
|
||||
- User
|
||||
- Guest
|
||||
type: string
|
||||
Username:
|
||||
minLength: 3
|
||||
type: string
|
||||
type: object
|
||||
widget.addWidgetRequest:
|
||||
|
@ -502,7 +521,8 @@ paths:
|
|||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: JSON web token, success status, message and authenticated user object
|
||||
description: JSON web token, success status, message and authenticated user
|
||||
object
|
||||
schema:
|
||||
$ref: '#/definitions/api.ResponseAuthenticate'
|
||||
"401":
|
||||
|
@ -513,7 +533,8 @@ paths:
|
|||
description: Internal server error.
|
||||
schema:
|
||||
$ref: '#/definitions/api.ResponseError'
|
||||
summary: Check if user is authenticated and provide details on how the user can authenticate
|
||||
summary: Check if user is authenticated and provide details on how the user
|
||||
can authenticate
|
||||
tags:
|
||||
- authentication
|
||||
/authenticate/{mechanism}:
|
||||
|
@ -540,7 +561,8 @@ paths:
|
|||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: JSON web token, success status, message and authenticated user object
|
||||
description: JSON web token, success status, message and authenticated user
|
||||
object
|
||||
schema:
|
||||
$ref: '#/definitions/api.ResponseAuthenticate'
|
||||
"401":
|
||||
|
@ -605,7 +627,8 @@ paths:
|
|||
- application/json
|
||||
operationId: addConfig
|
||||
parameters:
|
||||
- description: component configuration to be added incl. IDs of scenario and IC
|
||||
- description: component configuration to be added incl. IDs of scenario and
|
||||
IC
|
||||
in: body
|
||||
name: inputConfig
|
||||
required: true
|
||||
|
@ -1170,7 +1193,8 @@ paths:
|
|||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: Backend is healthy, database and AMQP broker connections are alive
|
||||
description: Backend is healthy, database and AMQP broker connections are
|
||||
alive
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
|
@ -1402,7 +1426,8 @@ paths:
|
|||
$ref: '#/definitions/api.ResponseError'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Send an action to IC (only available if backend server is started with -amqp parameter)
|
||||
summary: Send an action to IC (only available if backend server is started with
|
||||
-amqp parameter)
|
||||
tags:
|
||||
- infrastructure-components
|
||||
/ic/{ICID}/configs:
|
||||
|
@ -1670,6 +1695,7 @@ paths:
|
|||
- application/msexcel
|
||||
- application/xml
|
||||
- application/x-bag
|
||||
- multipart/form-data
|
||||
operationId: addResultFile
|
||||
parameters:
|
||||
- description: File to be uploaded
|
||||
|
@ -2078,7 +2104,8 @@ paths:
|
|||
- application/json
|
||||
operationId: AddSignal
|
||||
parameters:
|
||||
- description: A signal to be added to the component configuration incl. direction and config ID to which signal shall be added
|
||||
- description: A signal to be added to the component configuration incl. direction
|
||||
and config ID to which signal shall be added
|
||||
in: body
|
||||
name: inputSignal
|
||||
required: true
|
||||
|
@ -2363,7 +2390,8 @@ paths:
|
|||
- application/json
|
||||
operationId: UpdateUser
|
||||
parameters:
|
||||
- description: User to be updated (anything except for ID can be changed, role can only be change by admin)
|
||||
- description: User to be updated (anything except for ID can be changed, role
|
||||
can only be change by admin)
|
||||
in: body
|
||||
name: inputUser
|
||||
required: true
|
||||
|
|
1
go.sum
1
go.sum
|
@ -327,6 +327,7 @@ github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0
|
|||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
|
||||
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
|
|
|
@ -229,6 +229,7 @@ func deleteResult(c *gin.Context) {
|
|||
// @Accept application/msexcel
|
||||
// @Accept application/xml
|
||||
// @Accept application/x-bag
|
||||
// @Accept multipart/form-data
|
||||
// @Produce json
|
||||
// @Success 200 {object} api.ResponseResult "Result that was updated"
|
||||
// @Failure 400 {object} api.ResponseError "Bad request"
|
||||
|
|
Loading…
Add table
Reference in a new issue