This commit is contained in:
Mike Schwörer 2023-12-13 22:41:44 +01:00
parent e691640055
commit c38afc6ef3
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ func NewAPIHandler(app *logic.Application) APIHandler {
// @Router /server [GET] // @Router /server [GET]
func (h APIHandler) ListServer(pctx ginext.PreContext) ginext.HTTPResponse { func (h APIHandler) ListServer(pctx ginext.PreContext) ginext.HTTPResponse {
type response struct { type response struct {
Server []models.Server `json:"server"` Servers []models.Server `json:"servers"`
} }
ctx, _, errResp := pctx.Start() ctx, _, errResp := pctx.Start()
@ -43,5 +43,5 @@ func (h APIHandler) ListServer(pctx ginext.PreContext) ginext.HTTPResponse {
return ginext.Error(err) return ginext.Error(err)
} }
return ginext.JSON(http.StatusOK, response{Server: srvs}) return ginext.JSON(http.StatusOK, response{Servers: srvs})
} }

View File

@ -225,7 +225,7 @@
"handler.ListServer.response": { "handler.ListServer.response": {
"type": "object", "type": "object",
"properties": { "properties": {
"server": { "servers": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/models.Server" "$ref": "#/definitions/models.Server"

View File

@ -7,7 +7,7 @@ definitions:
type: object type: object
handler.ListServer.response: handler.ListServer.response:
properties: properties:
server: servers:
items: items:
$ref: '#/definitions/models.Server' $ref: '#/definitions/models.Server'
type: array type: array