From de550567a51de8dedf54c9ca5684b027dfd10ea7 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 11 Oct 2019 16:12:39 +0200 Subject: [PATCH 1/2] Swagger Auto Gen - Mint - #5038 swagger auto gen for mint module Signed-off-by: Marko Baricevic --- x/mint/client/rest/query.go | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/x/mint/client/rest/query.go b/x/mint/client/rest/query.go index f6e79cc31dcc..123fdb9b559e 100644 --- a/x/mint/client/rest/query.go +++ b/x/mint/client/rest/query.go @@ -28,6 +28,20 @@ func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router) { ).Methods("GET") } +type mintParams struct { // nolint: deadcode unused + Height int64 `json:"height"` + Result types.Params `json:"result"` +} + +// queryParamsHandlerFn implements a query route for params of the mint module +// +// @Summary Minting module parameters +// @Tags mint +// @Produce json +// @Param height query string false "Block height to execute query (defaults to chain tip)" +// @Success 200 {object} mintParams +// @Failure 500 {object} rest.ErrorResponse "Returned on server error" +// @Router /minting/parameters [get] func queryParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParameters) @@ -48,6 +62,20 @@ func queryParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { } } +type mintInflation struct { // nolint: deadcode unused + Height int64 `json:"height"` + Result string `json:"result"` +} + +// queryInflationHandlerFn implements a query for current minting inflation value +// +// @Summary Current minting inflation value +// @Tags mint +// @Produce json +// @Param height query string false "Block height to execute query (defaults to chain tip)" +// @Success 200 {object} mintInflation +// @Failure 500 {object} rest.ErrorResponse "Returned on server error" +// @Router /minting/inflation [get] func queryInflationHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryInflation) @@ -68,6 +96,20 @@ func queryInflationHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { } } +type mintAnnualProvisions struct { // nolint: deadcode unused + Height int64 `json:"height"` + Result string `json:"result"` +} + +// queryAnnualProvisionsHandlerFn implements a query for current minting annual provisions value +// +// @Summary Current minting annual provisions value +// @Tags mint +// @Produce json +// @Param height query string false "Block height to execute query (defaults to chain tip)" +// @Success 200 {object} mintAnnualProvisions +// @Failure 500 {object} rest.ErrorResponse "Returned on server error" +// @Router /minting/inflation [get] func queryAnnualProvisionsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAnnualProvisions) From 6660cb008339e458efb1d82b0a8822622449aa61 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 11 Oct 2019 16:26:04 +0200 Subject: [PATCH 2/2] update swagger --- client/rest/docs/docs.go | 158 +++++++++++++++++++++++++++++++++- client/rest/docs/swagger.json | 156 +++++++++++++++++++++++++++++++++ client/rest/docs/swagger.yaml | 107 +++++++++++++++++++++++ 3 files changed, 420 insertions(+), 1 deletion(-) diff --git a/client/rest/docs/docs.go b/client/rest/docs/docs.go index d68d793f2362..bbd6cf4fd744 100644 --- a/client/rest/docs/docs.go +++ b/client/rest/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2019-09-30 14:20:00.263784 -0400 EDT m=+0.392590706 +// 2019-10-11 16:25:51.499705 +0200 CEST m=+0.241916231 package docs @@ -617,6 +617,72 @@ var doc = `{ } } }, + "/minting/inflation": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "mint" + ], + "summary": "Current minting annual provisions value", + "parameters": [ + { + "type": "string", + "description": "Block height to execute query (defaults to chain tip)", + "name": "height", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/rest.mintAnnualProvisions" + } + }, + "500": { + "description": "Returned on server error", + "schema": { + "$ref": "#/definitions/rest.ErrorResponse" + } + } + } + } + }, + "/minting/parameters": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "mint" + ], + "summary": "Minting module parameters", + "parameters": [ + { + "type": "string", + "description": "Block height to execute query (defaults to chain tip)", + "name": "height", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/rest.mintParams" + } + }, + "500": { + "description": "Returned on server error", + "schema": { + "$ref": "#/definitions/rest.ErrorResponse" + } + } + } + } + }, "/txs": { "post": { "description": "Broadcast a signed transaction with the broadcasting mode. The\nmode must either be sync, async, or block. The use of block mode\nis not advised. The sync mode will broadcast and wait for a\nCheckTx response, whereas async mode will broadcast and return\nimmediately.", @@ -819,6 +885,40 @@ var doc = `{ } } }, + "rest.mintAnnualProvisions": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "result": { + "type": "string" + } + } + }, + "rest.mintInflation": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "result": { + "type": "string" + } + } + }, + "rest.mintParams": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "result": { + "type": "object", + "$ref": "#/definitions/types.Params" + } + } + }, "rest.postDeposit": { "type": "object", "properties": { @@ -1063,6 +1163,19 @@ var doc = `{ } } }, + "types.DepositParams": { + "type": "object", + "properties": { + "max_deposit_period": { + "description": "Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months", + "type": "string" + }, + "min_deposit": { + "description": "Minimum deposit for a proposal to enter voting period.", + "type": "string" + } + } + }, "types.MsgDeposit": { "type": "object", "properties": { @@ -1114,6 +1227,23 @@ var doc = `{ } } }, + "types.Params": { + "type": "object", + "properties": { + "deposit_params": { + "type": "object", + "$ref": "#/definitions/types.DepositParams" + }, + "tally_params": { + "type": "object", + "$ref": "#/definitions/types.TallyParams" + }, + "voting_params": { + "type": "object", + "$ref": "#/definitions/types.VotingParams" + } + } + }, "types.Proposal": { "type": "object", "properties": { @@ -1225,6 +1355,23 @@ var doc = `{ } } }, + "types.TallyParams": { + "type": "object", + "properties": { + "quorum": { + "description": "Minimum percentage of total stake needed to vote for a result to be considered valid", + "type": "string" + }, + "threshold": { + "description": "Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5", + "type": "string" + }, + "veto": { + "description": "Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3", + "type": "string" + } + } + }, "types.TallyResult": { "type": "object", "properties": { @@ -1330,6 +1477,15 @@ var doc = `{ } } }, + "types.VotingParams": { + "type": "object", + "properties": { + "voting_period": { + "description": "Length of the voting period.", + "type": "string" + } + } + }, "utils.Proposer": { "type": "object", "properties": { diff --git a/client/rest/docs/swagger.json b/client/rest/docs/swagger.json index dc41b2d771e7..5d99ecbc3568 100644 --- a/client/rest/docs/swagger.json +++ b/client/rest/docs/swagger.json @@ -596,6 +596,72 @@ } } }, + "/minting/inflation": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "mint" + ], + "summary": "Current minting annual provisions value", + "parameters": [ + { + "type": "string", + "description": "Block height to execute query (defaults to chain tip)", + "name": "height", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/rest.mintAnnualProvisions" + } + }, + "500": { + "description": "Returned on server error", + "schema": { + "$ref": "#/definitions/rest.ErrorResponse" + } + } + } + } + }, + "/minting/parameters": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "mint" + ], + "summary": "Minting module parameters", + "parameters": [ + { + "type": "string", + "description": "Block height to execute query (defaults to chain tip)", + "name": "height", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/rest.mintParams" + } + }, + "500": { + "description": "Returned on server error", + "schema": { + "$ref": "#/definitions/rest.ErrorResponse" + } + } + } + } + }, "/txs": { "post": { "description": "Broadcast a signed transaction with the broadcasting mode. The\nmode must either be sync, async, or block. The use of block mode\nis not advised. The sync mode will broadcast and wait for a\nCheckTx response, whereas async mode will broadcast and return\nimmediately.", @@ -798,6 +864,40 @@ } } }, + "rest.mintAnnualProvisions": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "result": { + "type": "string" + } + } + }, + "rest.mintInflation": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "result": { + "type": "string" + } + } + }, + "rest.mintParams": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "result": { + "type": "object", + "$ref": "#/definitions/types.Params" + } + } + }, "rest.postDeposit": { "type": "object", "properties": { @@ -1042,6 +1142,19 @@ } } }, + "types.DepositParams": { + "type": "object", + "properties": { + "max_deposit_period": { + "description": "Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months", + "type": "string" + }, + "min_deposit": { + "description": "Minimum deposit for a proposal to enter voting period.", + "type": "string" + } + } + }, "types.MsgDeposit": { "type": "object", "properties": { @@ -1093,6 +1206,23 @@ } } }, + "types.Params": { + "type": "object", + "properties": { + "deposit_params": { + "type": "object", + "$ref": "#/definitions/types.DepositParams" + }, + "tally_params": { + "type": "object", + "$ref": "#/definitions/types.TallyParams" + }, + "voting_params": { + "type": "object", + "$ref": "#/definitions/types.VotingParams" + } + } + }, "types.Proposal": { "type": "object", "properties": { @@ -1204,6 +1334,23 @@ } } }, + "types.TallyParams": { + "type": "object", + "properties": { + "quorum": { + "description": "Minimum percentage of total stake needed to vote for a result to be considered valid", + "type": "string" + }, + "threshold": { + "description": "Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5", + "type": "string" + }, + "veto": { + "description": "Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3", + "type": "string" + } + } + }, "types.TallyResult": { "type": "object", "properties": { @@ -1309,6 +1456,15 @@ } } }, + "types.VotingParams": { + "type": "object", + "properties": { + "voting_period": { + "description": "Length of the voting period.", + "type": "string" + } + } + }, "utils.Proposer": { "type": "object", "properties": { diff --git a/client/rest/docs/swagger.yaml b/client/rest/docs/swagger.yaml index 3a1c4cab1871..02599d828558 100644 --- a/client/rest/docs/swagger.yaml +++ b/client/rest/docs/swagger.yaml @@ -103,6 +103,28 @@ definitions: description: address of the voter type: string type: object + rest.mintAnnualProvisions: + properties: + height: + type: integer + result: + type: string + type: object + rest.mintInflation: + properties: + height: + type: integer + result: + type: string + type: object + rest.mintParams: + properties: + height: + type: integer + result: + $ref: '#/definitions/types.Params' + type: object + type: object rest.postDeposit: properties: fee: @@ -270,6 +292,16 @@ definitions: description: proposalID of the proposal type: integer type: object + types.DepositParams: + properties: + max_deposit_period: + description: 'Maximum period for Atom holders to deposit on a proposal. Initial + value: 2 months' + type: string + min_deposit: + description: Minimum deposit for a proposal to enter voting period. + type: string + type: object types.MsgDeposit: properties: amount: @@ -306,6 +338,18 @@ definitions: description: address of the voter type: string type: object + types.Params: + properties: + deposit_params: + $ref: '#/definitions/types.DepositParams' + type: object + tally_params: + $ref: '#/definitions/types.TallyParams' + type: object + voting_params: + $ref: '#/definitions/types.VotingParams' + type: object + type: object types.Proposal: properties: deposit_end_time: @@ -384,6 +428,21 @@ definitions: type: string type: object type: array + types.TallyParams: + properties: + quorum: + description: Minimum percentage of total stake needed to vote for a result + to be considered valid + type: string + threshold: + description: 'Minimum proportion of Yes votes for proposal to pass. Initial + value: 0.5' + type: string + veto: + description: 'Minimum value of Veto votes to Total votes ratio for proposal + to be vetoed. Initial value: 1/3' + type: string + type: object types.TallyResult: properties: abstain: @@ -458,6 +517,12 @@ definitions: type: string type: object type: array + types.VotingParams: + properties: + voting_period: + description: Length of the voting period. + type: string + type: object utils.Proposer: properties: proposal_id: @@ -889,6 +954,48 @@ paths: summary: Query a governance proposal's individual vote tags: - governance + /minting/inflation: + get: + parameters: + - description: Block height to execute query (defaults to chain tip) + in: query + name: height + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/rest.mintAnnualProvisions' + "500": + description: Returned on server error + schema: + $ref: '#/definitions/rest.ErrorResponse' + summary: Current minting annual provisions value + tags: + - mint + /minting/parameters: + get: + parameters: + - description: Block height to execute query (defaults to chain tip) + in: query + name: height + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/rest.mintParams' + "500": + description: Returned on server error + schema: + $ref: '#/definitions/rest.ErrorResponse' + summary: Minting module parameters + tags: + - mint /txs: post: consumes: