From 555450868ec60fd98024eeb942f608f976550242 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Wed, 7 Aug 2019 15:22:05 +0300 Subject: [PATCH] Move Swagger doc to server.go --- Makefile | 2 +- pkg/api/docs/docs.go | 2 +- pkg/api/main.go | 18 ------------------ pkg/api/server.go | 17 +++++++++++++++++ 4 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 pkg/api/main.go diff --git a/Makefile b/Makefile index 97db202..29381af 100644 --- a/Makefile +++ b/Makefile @@ -58,4 +58,4 @@ release: swagger: GO111MODULE=on go get github.com/swaggo/swag/cmd/swag - cd pkg/api && $$(go env GOPATH)/bin/swag init \ No newline at end of file + cd pkg/api && $$(go env GOPATH)/bin/swag init -g server.go \ No newline at end of file diff --git a/pkg/api/docs/docs.go b/pkg/api/docs/docs.go index 25075cb..08875c6 100644 --- a/pkg/api/docs/docs.go +++ b/pkg/api/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2019-08-07 15:15:38.193457 +0300 EEST m=+0.022158637 +// 2019-08-07 15:19:14.198371 +0300 EEST m=+0.021097345 package docs diff --git a/pkg/api/main.go b/pkg/api/main.go deleted file mode 100644 index 01aefc4..0000000 --- a/pkg/api/main.go +++ /dev/null @@ -1,18 +0,0 @@ -package api - -// @title Podinfo API -// @version 2.0 -// @description Go microservice template for Kubernetes. - -// @contact.name Source Code -// @contact.url https://github.com/stefanprodan/podinfo - -// @license.name MIT License -// @license.url https://github.com/stefanprodan/podinfo/blob/master/LICENSE - -// @host localhost:9898 -// @BasePath / -// @schemes http https - -type ArrayResponse []string -type MapResponse map[string]string diff --git a/pkg/api/server.go b/pkg/api/server.go index 84408cb..9367391 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -20,6 +20,20 @@ import ( "go.uber.org/zap" ) +// @title Podinfo API +// @version 2.0 +// @description Go microservice template for Kubernetes. + +// @contact.name Source Code +// @contact.url https://github.com/stefanprodan/podinfo + +// @license.name MIT License +// @license.url https://github.com/stefanprodan/podinfo/blob/master/LICENSE + +// @host localhost:9898 +// @BasePath / +// @schemes http https + var ( healthy int32 ready int32 @@ -222,3 +236,6 @@ func (s *Server) printRoutes() { return nil }) } + +type ArrayResponse []string +type MapResponse map[string]string