From b387ccb8274c1a37125b14c1001375744ee0471f Mon Sep 17 00:00:00 2001 From: Lee Brown Date: Wed, 7 Aug 2019 20:19:09 -0800 Subject: [PATCH] forked swaggo/swag and added caching to reduce build times --- README.md | 2 +- cmd/web-api/Dockerfile | 6 +- cmd/web-api/README.md | 6 +- cmd/web-api/docs/docs.go | 103 +++--------------- cmd/web-api/docs/swagger.json | 86 +-------------- cmd/web-api/docs/swagger.yaml | 84 -------------- go.mod | 9 +- go.sum | 33 +++++- internal/mid/saas-swagger/README.md | 8 +- .../mid/saas-swagger/example/docs/docs.go | 4 +- internal/mid/saas-swagger/swagger.go | 8 +- internal/signup/signup_test.go | 32 +++--- tools/devops/cmd/cicd/service_build.go | 1 + 13 files changed, 90 insertions(+), 292 deletions(-) diff --git a/README.md b/README.md index 244fd0a..64a3a41 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ For more details on this service, read [web-api readme](https://gitlab.com/geeks ### API Documentation -Documentation for this API service is automatically generated using [swag](https://github.com/swaggo/swag). Once this +Documentation for this API service is automatically generated using [swag](https://github.com/geeks-accelerator/swag). Once this web-api service is running, it can be accessed at /docs http://127.0.0.1:3001/docs/ diff --git a/cmd/web-api/Dockerfile b/cmd/web-api/Dockerfile index fe60f16..c4b3bbb 100644 --- a/cmd/web-api/Dockerfile +++ b/cmd/web-api/Dockerfile @@ -19,7 +19,7 @@ RUN GO111MODULE=off go get gopkg.in/go-playground/validator.v9 && \ GO111MODULE=off go get golang.org/x/crypto/nacl/secretbox # Install swag with go modules enabled. -RUN GO111MODULE=on go get -u github.com/swaggo/swag/cmd/swag +RUN GO111MODULE=on go get -u github.com/geeks-accelerator/swag/cmd/swag # Change dir to project base. WORKDIR $GOPATH/src/gitlab.com/geeks-accelerator/oss/saas-starter-kit @@ -34,6 +34,7 @@ FROM build_base_golang AS builder ARG service ARG commit_ref=- +ARG swagInit # Copy shared packages. COPY internal ./internal @@ -50,7 +51,8 @@ WORKDIR ./cmd/${service} # Update the API documentation. # Disabled for the moment as it takes forever to run, rely on manual execution. -#RUN swag init +RUN if [ "$swagInit" != "" ] swag init ; fi + RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X main.build=${commit_ref}" -a -installsuffix nocgo -o /gosrv . diff --git a/cmd/web-api/README.md b/cmd/web-api/README.md index 6aa1c06..a7f33e7 100644 --- a/cmd/web-api/README.md +++ b/cmd/web-api/README.md @@ -26,7 +26,7 @@ initial admin user must first be created. The initial admin user can easily be c ## API Documentation -Documentation for this API service is automatically generated using [swag](https://github.com/swaggo/swag). Once this +Documentation for this API service is automatically generated using [swag](https://github.com/geeks-accelerator/swag). Once this web-api service is running, it can be accessed at /docs http://127.0.0.1:3001/docs/ @@ -227,14 +227,14 @@ curl -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:3001/v1/users ## Update Swagger API Documentation -Documentation is generated using [swag](https://github.com/swaggo/swag) +Documentation is generated using [swag](https://github.com/geeks-accelerator/swag) If you are developing this web-api service and you want your changes reflected in the API documentation, you will need to download Swag and then run it each time you want the API documentation to be updated. Download Swag with this command: ```bash -go get -u github.com/swaggo/swag/cmd/swag +go get -u github.com/geeks-accelerator/swag/cmd/swag ``` Run `swag init` in the service's root folder which contains the main.go file. This will parse your comments and generate the required files (docs folder and docs/docs.go). diff --git a/cmd/web-api/docs/docs.go b/cmd/web-api/docs/docs.go index dceed3a..7d0ecb0 100644 --- a/cmd/web-api/docs/docs.go +++ b/cmd/web-api/docs/docs.go @@ -1,15 +1,16 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag at -// 2019-08-06 18:48:15.927954 -0800 AKDT m=+412.149396591 +// This file was generated by geeks-accelerator/swag at +// 2019-08-07 19:21:01.42416 -0800 AKDT m=+430.010377170 package docs import ( "bytes" "encoding/json" + "strings" "github.com/alecthomas/template" - "github.com/swaggo/swag" + "github.com/geeks-accelerator/swag" ) var doc = `{ @@ -17,7 +18,7 @@ var doc = `{ "swagger": "2.0", "info": { "description": "{{.Description}}", - "title": "SaaS Example API", + "title": "{{.Title}}", "contact": {}, "license": { "name": "Apache 2.0", @@ -63,21 +64,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -115,28 +113,24 @@ var doc = `{ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/account.AccountResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -178,21 +172,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -262,21 +253,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -317,35 +305,30 @@ var doc = `{ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/project.ProjectResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -385,21 +368,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -441,21 +421,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -493,28 +470,24 @@ var doc = `{ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/project.ProjectResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -551,21 +524,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -601,21 +571,18 @@ var doc = `{ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/signup.SignupResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -685,21 +652,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -738,35 +702,30 @@ var doc = `{ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/user_account.UserAccountResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -803,21 +762,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -857,21 +813,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -913,21 +866,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -965,28 +915,24 @@ var doc = `{ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/user_account.UserAccountResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1056,14 +1002,12 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1102,28 +1046,24 @@ var doc = `{ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/user.UserResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1163,21 +1103,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1219,21 +1156,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1275,21 +1209,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1328,21 +1259,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1380,28 +1308,24 @@ var doc = `{ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/user.UserResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1438,21 +1362,18 @@ var doc = `{ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -2211,11 +2132,21 @@ type swaggerInfo struct { } // SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = swaggerInfo{Schemes: []string{}} +var SwaggerInfo = swaggerInfo{ + Version: "", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "SaaS Example API", + 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) @@ -2227,7 +2158,7 @@ func (s *s) ReadDoc() string { } var tpl bytes.Buffer - if err := t.Execute(&tpl, SwaggerInfo); err != nil { + if err := t.Execute(&tpl, sInfo); err != nil { return doc } diff --git a/cmd/web-api/docs/swagger.json b/cmd/web-api/docs/swagger.json index 68c5915..4f2c45e 100644 --- a/cmd/web-api/docs/swagger.json +++ b/cmd/web-api/docs/swagger.json @@ -1,17 +1,13 @@ { "swagger": "2.0", "info": { - "description": "{{.Description}}", "title": "SaaS Example API", "contact": {}, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "version": "{{.Version}}" + } }, - "host": "{{.Host}}", - "basePath": "{{.BasePath}}", "paths": { "/accounts": { "patch": { @@ -48,21 +44,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -100,28 +93,24 @@ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/account.AccountResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -163,21 +152,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -247,21 +233,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -302,35 +285,30 @@ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/project.ProjectResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -370,21 +348,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -426,21 +401,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -478,28 +450,24 @@ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/project.ProjectResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -536,21 +504,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -586,21 +551,18 @@ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/signup.SignupResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -670,21 +632,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -723,35 +682,30 @@ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/user_account.UserAccountResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -788,21 +742,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -842,21 +793,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -898,21 +846,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -950,28 +895,24 @@ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/user_account.UserAccountResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1041,14 +982,12 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1087,28 +1026,24 @@ "201": { "description": "Created", "schema": { - "type": "object", "$ref": "#/definitions/user.UserResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1148,21 +1083,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1204,21 +1136,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1260,21 +1189,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1313,21 +1239,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "401": { "description": "Unauthorized", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1365,28 +1288,24 @@ "200": { "description": "OK", "schema": { - "type": "object", "$ref": "#/definitions/user.UserResponse" } }, "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } @@ -1423,21 +1342,18 @@ "400": { "description": "Bad Request", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { - "type": "object", "$ref": "#/definitions/weberror.ErrorResponse" } } diff --git a/cmd/web-api/docs/swagger.yaml b/cmd/web-api/docs/swagger.yaml index 47ef921..3da3cb7 100644 --- a/cmd/web-api/docs/swagger.yaml +++ b/cmd/web-api/docs/swagger.yaml @@ -1,4 +1,3 @@ -basePath: '{{.BasePath}}' definitions: account.AccountResponse: properties: @@ -518,15 +517,12 @@ definitions: value: type: object type: object -host: '{{.Host}}' info: contact: {} - description: '{{.Description}}' license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html title: SaaS Example API - version: '{{.Version}}' paths: /accounts: patch: @@ -549,17 +545,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Update account by ID @@ -583,22 +576,18 @@ paths: description: OK schema: $ref: '#/definitions/account.AccountResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "404": description: Not Found schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Get account by ID @@ -626,17 +615,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "401": description: Unauthorized schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - BasicAuth: [] summary: Token handles a request to authenticate a user. @@ -681,17 +667,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: List projects @@ -718,17 +701,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Update project by ID @@ -753,27 +733,22 @@ paths: description: Created schema: $ref: '#/definitions/project.ProjectResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "404": description: Not Found schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Create new project. @@ -798,17 +773,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Delete project by ID @@ -831,22 +803,18 @@ paths: description: OK schema: $ref: '#/definitions/project.ProjectResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "404": description: Not Found schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Get project by ID. @@ -873,17 +841,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Archive project by ID @@ -909,17 +874,14 @@ paths: description: Created schema: $ref: '#/definitions/signup.SignupResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object summary: Signup handles new account creation. tags: - signup @@ -942,17 +904,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Delete user account by user ID and account ID @@ -996,17 +955,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: List user accounts @@ -1032,17 +988,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Update user account by user ID and account ID @@ -1067,27 +1020,22 @@ paths: description: Created schema: $ref: '#/definitions/user_account.UserAccountResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "404": description: Not Found schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Create new user account. @@ -1111,22 +1059,18 @@ paths: description: OK schema: $ref: '#/definitions/user_account.UserAccountResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "404": description: Not Found schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Get user account by ID @@ -1153,17 +1097,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Archive user account by user ID and account ID @@ -1209,12 +1150,10 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: List users @@ -1240,17 +1179,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Update user by ID @@ -1275,22 +1211,18 @@ paths: description: Created schema: $ref: '#/definitions/user.UserResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Create new user. @@ -1315,17 +1247,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Delete user by ID @@ -1348,22 +1277,18 @@ paths: description: OK schema: $ref: '#/definitions/user.UserResponse' - type: object "400": description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "404": description: Not Found schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Get user by ID @@ -1390,17 +1315,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Archive user by ID @@ -1427,17 +1349,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "403": description: Forbidden schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Update user password by ID @@ -1462,17 +1381,14 @@ paths: description: Bad Request schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "401": description: Unauthorized schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object "500": description: Internal Server Error schema: $ref: '#/definitions/weberror.ErrorResponse' - type: object security: - OAuth2Password: [] summary: Switch account. diff --git a/go.mod b/go.mod index 91f58a2..a919242 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,9 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/fatih/camelcase v1.0.0 github.com/fatih/structtag v1.0.0 + github.com/geeks-accelerator/files v0.0.0-20190704085106-630677cd5c14 // indirect github.com/geeks-accelerator/sqlxmigrate v0.0.0-20190527223850-4a863a2d30db + github.com/geeks-accelerator/swag v1.6.3 // indirect github.com/go-openapi/spec v0.19.2 // indirect github.com/go-openapi/swag v0.19.4 // indirect github.com/go-playground/locales v0.12.1 @@ -26,6 +28,7 @@ require ( github.com/iancoleman/strcase v0.0.0-20190422225806-e506e3ef7365 github.com/ikeikeikeike/go-sitemap-generator/v2 v2.0.2 github.com/jmoiron/sqlx v1.2.0 + github.com/json-iterator/go v1.1.7 // indirect github.com/kelseyhightower/envconfig v1.4.0 github.com/kr/pty v1.1.8 // indirect github.com/leodido/go-urn v1.1.0 // indirect @@ -44,17 +47,15 @@ require ( github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 github.com/stretchr/testify v1.3.0 github.com/sudo-suhas/symcrypto v1.0.0 - github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 - github.com/swaggo/swag v1.6.2 github.com/tinylib/msgp v1.1.0 // indirect + github.com/ugorji/go v1.1.7 // indirect github.com/urfave/cli v1.21.0 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 - golang.org/x/tools v0.0.0-20190805222050-c5a2fd39b72a // indirect - golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 // indirect + golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de // indirect google.golang.org/appengine v1.6.1 // indirect gopkg.in/DataDog/dd-trace-go.v1 v1.16.1 gopkg.in/go-playground/validator.v9 v9.29.1 diff --git a/go.sum b/go.sum index d297042..6f635b9 100644 --- a/go.sum +++ b/go.sum @@ -32,10 +32,17 @@ github.com/fatih/structtag v1.0.0 h1:pTHj65+u3RKWYPSGaU290FpI/dXxTaHdVwVwbcPKmEc github.com/fatih/structtag v1.0.0/go.mod h1:IKitwq45uXL/yqi5mYghiD3w9H6eTOvI9vnk8tXMphA= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/geeks-accelerator/files v0.0.0-20190704085106-630677cd5c14 h1:Rrxsq3gr2TWGdnSWHfRbhP/hcxatCyC9kMgLZ3da75A= +github.com/geeks-accelerator/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:HMLrFyDC+sI+871eKlqqIBcaDim/NI8//Mbe+UwhY78= github.com/geeks-accelerator/sqlxmigrate v0.0.0-20190527223850-4a863a2d30db h1:mjErP7mTFHQ3cw/ibAkW3CvQ8gM4k19EkfzRzRINDAE= github.com/geeks-accelerator/sqlxmigrate v0.0.0-20190527223850-4a863a2d30db/go.mod h1:dzpCjo4q7chhMVuHDzs/odROkieZ5Wjp70rNDuX83jU= +github.com/geeks-accelerator/swag v1.6.3 h1:WottuX4MHoy5ZJFXfL+p1IrChpUb/e4g5vpM6tcwOIE= +github.com/geeks-accelerator/swag v1.6.3/go.mod h1:YWy7dtuct7Uk3vmKr7s+v/F0SNkGYEeV7Y1CykFhmWU= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2 h1:A9+F4Dc/MCNB5jibxf6rRvOvR/iFgQdyNx9eIhnGqq0= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= @@ -72,6 +79,7 @@ github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -95,6 +103,8 @@ github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -114,11 +124,17 @@ github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o= github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q= github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -149,12 +165,13 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/sudo-suhas/symcrypto v1.0.0 h1:VG6FdACf5XeXFQUzeA++aB6snNThz0OFlmUHiCddi2s= github.com/sudo-suhas/symcrypto v1.0.0/go.mod h1:g/faGDjhlF/DXdqp3+SQ0LmhPcv4iYaIRjcm/Q60+68= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= -github.com/swaggo/swag v1.6.2 h1:WQMAtT/FmMBb7g0rAuHDhG3vvdtHKJ3WZ+Ssb0p4Y6E= -github.com/swaggo/swag v1.6.2/go.mod h1:YyZstMc22WYm6GEDx/CYWxq+faBbjQ5EqwQcrjREDBo= github.com/tinylib/msgp v1.1.0 h1:9fQd+ICuRIu/ue4vxJZu6/LzxN0HwMds2nq/0cFvxHU= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.21.0 h1:wYSSj06510qPIzGSua9ZqsncMmWE3Zr55KBERygyrxE= @@ -172,7 +189,9 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -183,8 +202,10 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEha golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190730183949-1393eb018365 h1:SaXEMXhWzMJThc05vu6uh61Q245r4KaWMrsTedk0FDc= golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -196,11 +217,14 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190606050223-4d9ae51c2468/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190611222205-d73e1c7e250b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190730205120-7deaedd405c4 h1:GhbPrljMrt6gCNHHAJcWLDV3nDPFkIm0EEuqY9GtuX0= golang.org/x/tools v0.0.0-20190730205120-7deaedd405c4/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190805222050-c5a2fd39b72a h1:0AGI+cC4FJwXNdClvHzfHhJf/yPjKwdo/+m0lPKrdJA= golang.org/x/tools v0.0.0-20190805222050-c5a2fd39b72a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= +golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de h1:VNumCimp/Bwk6fRqgPHkjiUPZ/vzlpi23/kQTuQ4gBA= +golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -215,6 +239,7 @@ gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc= gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= diff --git a/internal/mid/saas-swagger/README.md b/internal/mid/saas-swagger/README.md index 20c6c3e..04d4e26 100644 --- a/internal/mid/saas-swagger/README.md +++ b/internal/mid/saas-swagger/README.md @@ -12,14 +12,14 @@ saas middleware to automatically generate RESTful API documentation with Swagger ## Usage ### Start using it -1. Add comments to your API source code, [See Declarative Comments Format](https://github.com/swaggo/swag#declarative-comments-format). +1. Add comments to your API source code, [See Declarative Comments Format](https://github.com/geeks-accelerator/swag#declarative-comments-format). -2. Download [Swag](https://github.com/swaggo/swag) for Go by using: +2. Download [Swag](https://github.com/geeks-accelerator/swag) for Go by using: ```sh - $ go get github.com/swaggo/swag/cmd/swag + $ go get github.com/geeks-accelerator/swag/cmd/swag ``` -3. Run the [Swag](https://github.com/swaggo/swag) in your Go project root folder which contains `main.go` file, [Swag](https://github.com/swaggo/swag) will parse comments and generate required files(`docs` folder and `docs/doc.go`). +3. Run the [Swag](https://github.com/geeks-accelerator/swag) in your Go project root folder which contains `main.go` file, [Swag](https://github.com/geeks-accelerator/swag) will parse comments and generate required files(`docs` folder and `docs/doc.go`). ```sh_ "github.com/swaggo/echo-swagger/v2/example/docs" $ swag init ``` diff --git a/internal/mid/saas-swagger/example/docs/docs.go b/internal/mid/saas-swagger/example/docs/docs.go index 09c05bd..ee33096 100644 --- a/internal/mid/saas-swagger/example/docs/docs.go +++ b/internal/mid/saas-swagger/example/docs/docs.go @@ -1,5 +1,5 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag at +// This file was generated by geeks-accelerator/swag at // 2019-06-24 13:07:10.15232 -0800 AKDT m=+0.076902855 package docs @@ -8,7 +8,7 @@ import ( "bytes" "github.com/alecthomas/template" - "github.com/swaggo/swag" + "github.com/geeks-accelerator/swag" ) var doc = `{ diff --git a/internal/mid/saas-swagger/swagger.go b/internal/mid/saas-swagger/swagger.go index 0acf0ec..12056fd 100644 --- a/internal/mid/saas-swagger/swagger.go +++ b/internal/mid/saas-swagger/swagger.go @@ -3,17 +3,17 @@ package saasSwagger import ( "context" "fmt" - "geeks-accelerator/oss/saas-starter-kit/internal/platform/web/weberror" - "github.com/pborman/uuid" "html/template" "net/http" "regexp" "strings" + "github.com/pborman/uuid" + "geeks-accelerator/oss/saas-starter-kit/internal/platform/web/weberror" "geeks-accelerator/oss/saas-starter-kit/internal/platform/web" "github.com/pkg/errors" - "github.com/swaggo/files" - "github.com/swaggo/swag" + "github.com/geeks-accelerator/files" + "github.com/geeks-accelerator/swag" ) var ( diff --git a/internal/signup/signup_test.go b/internal/signup/signup_test.go index 7dbb664..a6ec49e 100644 --- a/internal/signup/signup_test.go +++ b/internal/signup/signup_test.go @@ -1,13 +1,13 @@ package signup import ( + "geeks-accelerator/oss/saas-starter-kit/internal/user_auth" "os" "testing" "time" "geeks-accelerator/oss/saas-starter-kit/internal/platform/auth" "geeks-accelerator/oss/saas-starter-kit/internal/platform/tests" - "geeks-accelerator/oss/saas-starter-kit/internal/user" "github.com/google/go-cmp/cmp" "github.com/pborman/uuid" "github.com/pkg/errors" @@ -40,15 +40,17 @@ func TestSignupValidation(t *testing.T) { func(req SignupRequest, res *SignupResult) *SignupResult { return nil }, - errors.New("Key: 'SignupRequest.account.name' Error:Field validation for 'name' failed on the 'required' tag\n" + - "Key: 'SignupRequest.account.address1' Error:Field validation for 'address1' failed on the 'required' tag\n" + - "Key: 'SignupRequest.account.city' Error:Field validation for 'city' failed on the 'required' tag\n" + - "Key: 'SignupRequest.account.region' Error:Field validation for 'region' failed on the 'required' tag\n" + - "Key: 'SignupRequest.account.country' Error:Field validation for 'country' failed on the 'required' tag\n" + - "Key: 'SignupRequest.account.zipcode' Error:Field validation for 'zipcode' failed on the 'required' tag\n" + - "Key: 'SignupRequest.user.name' Error:Field validation for 'name' failed on the 'required' tag\n" + - "Key: 'SignupRequest.user.email' Error:Field validation for 'email' failed on the 'required' tag\n" + - "Key: 'SignupRequest.user.password' Error:Field validation for 'password' failed on the 'required' tag"), + errors.New("Key: 'SignupRequest.{{account}}.{{name}}' Error:Field validation for '{{name}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{account}}.{{address1}}' Error:Field validation for '{{address1}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{account}}.{{city}}' Error:Field validation for '{{city}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{account}}.{{region}}' Error:Field validation for '{{region}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{account}}.{{country}}' Error:Field validation for '{{country}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{account}}.{{zipcode}}' Error:Field validation for '{{zipcode}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{user}}.{{first_name}}' Error:Field validation for '{{first_name}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{user}}.{{last_name}}' Error:Field validation for '{{last_name}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{user}}.{{email}}' Error:Field validation for '{{email}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{user}}.{{password}}' Error:Field validation for '{{password}}' failed on the 'required' tag\n" + + "Key: 'SignupRequest.{{user}}.{{password_confirm}}' Error:Field validation for '{{password_confirm}}' failed on the 'required' tag"), }, } @@ -111,7 +113,8 @@ func TestSignupFull(t *testing.T) { Zipcode: "99686", }, User: SignupUser{ - Name: "Lee Brown", + FirstName: "Lee", + LastName: "Brown", Email: uuid.NewRandom().String() + "@geeksinthewoods.com", Password: "akTechFr0n!ier", PasswordConfirm: "akTechFr0n!ier", @@ -122,7 +125,7 @@ func TestSignupFull(t *testing.T) { now := time.Date(2018, time.October, 1, 0, 0, 0, 0, time.UTC) - tknGen := &user.MockTokenGenerator{} + tknGen := &auth.MockTokenGenerator{} t.Log("Given the need to ensure signup works.") { @@ -159,7 +162,10 @@ func TestSignupFull(t *testing.T) { t.Logf("\t%s\tSignup ok.", tests.Success) // Verify that the user can be authenticated with the updated password. - _, err = user.Authenticate(ctx, test.MasterDB, tknGen, res.User.Email, req.User.Password, time.Hour, now) + _, err = user_auth.Authenticate(ctx, test.MasterDB, tknGen, user_auth.AuthenticateRequest{ + Email:res.User.Email, + Password: req.User.Password, + }, time.Hour, now) if err != nil { t.Log("\t\tGot :", err) t.Fatalf("\t%s\tAuthenticate failed.", tests.Failed) diff --git a/tools/devops/cmd/cicd/service_build.go b/tools/devops/cmd/cicd/service_build.go index 46bded4..8225bba 100644 --- a/tools/devops/cmd/cicd/service_build.go +++ b/tools/devops/cmd/cicd/service_build.go @@ -332,6 +332,7 @@ func ServiceBuild(log *log.Logger, req *serviceBuildRequest) error { "--build-arg", "service=" + req.ServiceName, "--build-arg", "env=" + req.Env, "--build-arg", "commit_ref=" + req.CommitRef, + "--build-arg", "swagInit=1", "-t", req.ReleaseImage, }