From 9ead0852a8702138faed836a02a5bff73400038c Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Tue, 1 Feb 2022 18:16:39 +0100 Subject: [PATCH] Fix /swagger.json url --- go.mod | 4 ++- pkg/api/controllers/config_controller.go | 2 +- pkg/api/controllers/swagger.yaml | 38 ++++++++++++------------ pkg/api/routes/routes.go | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index d8f8da369..6f271620c 100644 --- a/go.mod +++ b/go.mod @@ -38,6 +38,8 @@ require ( ) require ( + github.com/davecgh/go-spew v1.1.1 github.com/go-logr/stdr v1.2.2 // indirect - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ) diff --git a/pkg/api/controllers/config_controller.go b/pkg/api/controllers/config_controller.go index 4b69c3fcf..885a929be 100644 --- a/pkg/api/controllers/config_controller.go +++ b/pkg/api/controllers/config_controller.go @@ -2,7 +2,7 @@ package controllers import ( "bytes" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "net/http" _ "embed" diff --git a/pkg/api/controllers/swagger.yaml b/pkg/api/controllers/swagger.yaml index e57efbbb2..110aa4707 100644 --- a/pkg/api/controllers/swagger.yaml +++ b/pkg/api/controllers/swagger.yaml @@ -13,7 +13,7 @@ paths: description: Show server informations operationId: getInfo responses: - 200: + "200": description: OK content: application/json: @@ -38,7 +38,7 @@ paths: schema: type: string responses: - 200: + "200": description: OK content: application/json: @@ -64,7 +64,7 @@ paths: schema: type: string responses: - 200: + "200": description: OK content: application/json: @@ -97,9 +97,9 @@ paths: $ref: '#/components/schemas/Metadata' required: true responses: - 204: + "204": description: Empty response - 400: + "400": description: "" content: {} /{ledger}/mapping: @@ -117,7 +117,7 @@ paths: schema: type: string responses: - 200: + "200": description: OK content: application/json: @@ -144,7 +144,7 @@ paths: $ref: '#/components/schemas/Mapping' required: true responses: - 200: + "200": description: OK content: application/json: @@ -173,7 +173,7 @@ paths: $ref: '#/components/schemas/Script' required: true responses: - 200: + "200": description: OK content: application/json: @@ -197,7 +197,7 @@ paths: schema: type: string responses: - 200: + "200": description: OK content: application/json: @@ -235,7 +235,7 @@ paths: schema: type: string responses: - 200: + "200": description: OK content: application/json: @@ -264,19 +264,19 @@ paths: $ref: '#/components/schemas/TransactionData' required: true responses: - 200: + "200": description: OK content: application/json: schema: $ref: '#/components/schemas/CreateTransactionResponse' - 400: + "400": description: Commit error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - 409: + "409": description: Confict content: application/json: @@ -304,13 +304,13 @@ paths: schema: type: integer responses: - 200: + "200": description: OK content: application/json: schema: $ref: '#/components/schemas/TransactionResponse' - 404: + "404": description: Not Found content: application/json: @@ -343,7 +343,7 @@ paths: schema: $ref: '#/components/schemas/Metadata' responses: - 204: + "204": description: Empty response content: {} /{ledger}/transactions/{txid}/revert: @@ -367,7 +367,7 @@ paths: schema: type: integer responses: - 204: + "204": description: Empty response content: {} /{ledger}/transactions/batch: @@ -394,13 +394,13 @@ paths: $ref: '#/components/schemas/Transactions' required: true responses: - 200: + "200": description: OK content: application/json: schema: $ref: '#/components/schemas/TransactionListResponse' - 400: + "400": description: "" content: application/json: diff --git a/pkg/api/routes/routes.go b/pkg/api/routes/routes.go index bdec8d35f..fde6c6bdb 100644 --- a/pkg/api/routes/routes.go +++ b/pkg/api/routes/routes.go @@ -107,7 +107,7 @@ func (r *Routes) Engine(cc cors.Config) *gin.Engine { engine.Use(globalMiddlewares...) engine.GET("/swagger.yaml", r.configController.GetDocsAsYaml) - //engine.GET("/swagger.json", r.configController.GetDocsAsJSON) + engine.GET("/swagger.json", r.configController.GetDocsAsJSON) // API Routes engine.GET("/_info", r.configController.GetInfo)