diff --git a/CHANGELOG.md b/CHANGELOG.md index 261484fe56a..d920485715e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). This means `zebrad` no longer contains users' viewing keys. - We're no longer using general conditional compilation attributes for `tor`, but only feature flags instead. +- Fixed a bug with trailing characters in the openapi spec method descriptions((#8597)[https://github.com/ZcashFoundation/zebra/pull/8597]) ## [Zebra 1.7.0](https://github.com/ZcashFoundation/zebra/releases/tag/v1.7.0) - 2024-05-07 diff --git a/openapi.yaml b/openapi.yaml index 679ac134854..efed590edd2 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -11,16 +11,11 @@ info: servers: - url: http://localhost:8232 paths: - /sendrawtransaction: + /getpeerinfo: post: tags: - - transaction - description: |- - Sends the raw bytes of a signed transaction to the local node''s mempool, if the transaction is valid."] - - **Request body `params` arguments:** - - - `raw_transaction_hex` - The hex-encoded raw transaction bytes. + - network + description: Returns data about each connected network node. requestBody: required: true content: @@ -31,10 +26,10 @@ paths: params: type: array items: {} - default: '["signedhex"]' + default: '[]' method: type: string - default: sendrawtransaction + default: getpeerinfo id: type: number default: '123' @@ -49,21 +44,11 @@ paths: result: type: object default: '{}' - '400': - description: Bad request - content: - application/json: - schema: - type: object - properties: - error: - type: string - default: Invalid parameters - /getinfo: + /getmininginfo: post: tags: - - control - description: Returns software information from the RPC server, as a [`GetInfo`] JSON struct."] + - mining + description: Returns mining-related information. requestBody: required: true content: @@ -73,7 +58,7 @@ paths: properties: method: type: string - default: getinfo + default: getmininginfo id: type: number default: '123' @@ -91,17 +76,17 @@ paths: properties: result: type: object - default: '{"build":"some build version","subversion":"some subversion"}' - /getblockhash: + default: '{}' + /getaddressbalance: post: tags: - - blockchain + - address description: |- - Returns the hash of the block of a given height iff the index argument correspond"] + Returns the total balance of a provided `addresses` in an [`AddressBalance`] instance. **Request body `params` arguments:** - - `index` - The block index. + - `address_strings` - A JSON map with a single entry requestBody: required: true content: @@ -109,27 +94,17 @@ paths: schema: type: object properties: - params: - type: array - items: {} - default: '[1]' method: type: string - default: getblockhash + default: getaddressbalance id: type: number default: '123' + params: + type: array + items: {} + default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"]}]' responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - result: - type: object - default: '"0000000000000000000000000000000000000000000000000000000000000000"' '400': description: Bad request content: @@ -140,29 +115,6 @@ paths: error: type: string default: Invalid parameters - /getmininginfo: - post: - tags: - - mining - description: Returns mining-related information."] - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - method: - type: string - default: getmininginfo - id: - type: number - default: '123' - params: - type: array - items: {} - default: '[]' - responses: '200': description: OK content: @@ -178,7 +130,7 @@ paths: tags: - util description: |- - Checks if a zcash address is valid."] + Checks if a zcash address is valid. **Request body `params` arguments:** @@ -190,13 +142,13 @@ paths: schema: type: object properties: - method: - type: string - default: validateaddress params: type: array items: {} default: '[]' + method: + type: string + default: validateaddress id: type: number default: '123' @@ -211,16 +163,17 @@ paths: result: type: object default: '{}' - /getblocksubsidy: + /getblock: post: tags: - - mining + - blockchain description: |- - Returns the block subsidy reward of the block at `height`, taking into account the mining slow start."] + Returns the requested block by hash or height, as a [`GetBlock`] JSON string. **Request body `params` arguments:** - - `height` - Can be any valid current or future height. + - `hash_or_height` - The hash or height for the block to be returned. + - `verbosity` - 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data. requestBody: required: true content: @@ -234,10 +187,10 @@ paths: params: type: array items: {} - default: '[1]' + default: '["1", 1]' method: type: string - default: getblocksubsidy + default: getblock responses: '200': description: OK @@ -248,7 +201,7 @@ paths: properties: result: type: object - default: '{}' + default: '{"hash":"0000000000000000000000000000000000000000000000000000000000000000","confirmations":0,"tx":[],"trees":{}}' '400': description: Bad request content: @@ -259,16 +212,16 @@ paths: error: type: string default: Invalid parameters - /submitblock: + /getaddresstxids: post: tags: - - mining + - address description: |- - Submits block to the node to be validated and committed."] + Returns the transaction ids made by the provided transparent addresses. **Request body `params` arguments:** - - `jsonparametersobject` - - currently ignored + - `request` - A struct with the following named fields: requestBody: required: true content: @@ -276,16 +229,16 @@ paths: schema: type: object properties: + method: + type: string + default: getaddresstxids id: type: number default: '123' params: type: array items: {} - default: '[]' - method: - type: string - default: submitblock + default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"], "start": 1000, "end": 2000}]' responses: '200': description: OK @@ -297,16 +250,26 @@ paths: result: type: object default: '{}' - /z_listunifiedreceivers: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getaddressutxos: post: tags: - - wallet + - address description: |- - Returns the list of individual payment addresses given a unified address."] + Returns all unspent outputs for a list of addresses. **Request body `params` arguments:** - - `address` - The zcash unified address to get the list from. + - `addresses` - The addresses to get outputs from. requestBody: required: true content: @@ -314,17 +277,27 @@ paths: schema: type: object properties: - method: - type: string - default: z_listunifiedreceivers id: type: number default: '123' params: type: array items: {} - default: '[]' + default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"]}]' + method: + type: string + default: getaddressutxos responses: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters '200': description: OK content: @@ -335,11 +308,17 @@ paths: result: type: object default: '{}' - /getblockcount: + /getrawtransaction: post: tags: - - blockchain - description: Returns the height of the most recent block in the best valid block chain (equivalently,"] + - transaction + description: |- + Returns the raw transaction data, as a [`GetRawTransaction`] JSON string or structure. + + **Request body `params` arguments:** + + - `txid` - The transaction ID of the transaction to be returned. + - `verbose` - If 0, return a string of hex-encoded data, otherwise return a JSON object. requestBody: required: true content: @@ -347,16 +326,16 @@ paths: schema: type: object properties: - id: - type: number - default: '123' params: type: array items: {} - default: '[]' + default: '["mytxid", 1]' + id: + type: number + default: '123' method: type: string - default: getblockcount + default: getrawtransaction responses: '200': description: OK @@ -368,16 +347,26 @@ paths: result: type: object default: '{}' - /getaddressutxos: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /submitblock: post: tags: - - address + - mining description: |- - Returns all unspent outputs for a list of addresses."] + Submits block to the node to be validated and committed. **Request body `params` arguments:** - - `addresses` - The addresses to get outputs from. + - `jsonparametersobject` - - currently ignored requestBody: required: true content: @@ -385,27 +374,50 @@ paths: schema: type: object properties: - id: - type: number - default: '123' method: type: string - default: getaddressutxos + default: submitblock params: type: array items: {} - default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"]}]' + default: '[]' + id: + type: number + default: '123' responses: - '400': - description: Bad request + '200': + description: OK content: application/json: schema: type: object properties: - error: - type: string - default: Invalid parameters + result: + type: object + default: '{}' + /getnetworkhashps: + post: + tags: + - mining + description: Returns the estimated network solutions per second based on the last `num_blocks` before + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + method: + type: string + default: getnetworkhashps + params: + type: array + items: {} + default: '[]' + id: + type: number + default: '123' + responses: '200': description: OK content: @@ -416,16 +428,16 @@ paths: result: type: object default: '{}' - /getaddresstxids: + /getblocksubsidy: post: tags: - - address + - mining description: |- - Returns the transaction ids made by the provided transparent addresses."] + Returns the block subsidy reward of the block at `height`, taking into account the mining slow start. **Request body `params` arguments:** - - `request` - A struct with the following named fields: + - `height` - Can be any valid current or future height. requestBody: required: true content: @@ -435,14 +447,14 @@ paths: properties: method: type: string - default: getaddresstxids + default: getblocksubsidy id: type: number default: '123' params: type: array items: {} - default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"], "start": 1000, "end": 2000}]' + default: '[1]' responses: '400': description: Bad request @@ -464,18 +476,11 @@ paths: result: type: object default: '{}' - /z_getsubtreesbyindex: + /getnetworksolps: post: tags: - - blockchain - description: |- - Returns information about a range of Sapling or Orchard subtrees."] - - **Request body `params` arguments:** - - - `pool` - The pool from which subtrees should be returned. Either \"sapling\" or \"orchard\". - - `start_index` - The index of the first 2^16-leaf subtree to return. - - `limit` - The maximum number of subtree values to return. + - mining + description: Returns the estimated network solutions per second based on the last `num_blocks` before requestBody: required: true content: @@ -489,7 +494,7 @@ paths: default: '[]' method: type: string - default: z_getsubtreesbyindex + default: getnetworksolps id: type: number default: '123' @@ -504,28 +509,35 @@ paths: result: type: object default: '{}' - /getpeerinfo: + /z_getsubtreesbyindex: post: tags: - - network - description: Returns data about each connected network node."] - requestBody: - required: true - content: - application/json: - schema: - type: object + - blockchain + description: |- + Returns information about a range of Sapling or Orchard subtrees. + + **Request body `params` arguments:** + + - `pool` - The pool from which subtrees should be returned. Either \"sapling\" or \"orchard\". + - `start_index` - The index of the first 2^16-leaf subtree to return. + - `limit` - The maximum number of subtree values to return. + requestBody: + required: true + content: + application/json: + schema: + type: object properties: - id: - type: number - default: '123' params: type: array items: {} default: '[]' + id: + type: number + default: '123' method: type: string - default: getpeerinfo + default: z_getsubtreesbyindex responses: '200': description: OK @@ -537,11 +549,11 @@ paths: result: type: object default: '{}' - /getbestblockhash: + /getblockchaininfo: post: tags: - blockchain - description: Returns the hash of the current best blockchain tip block, as a [`GetBlockHash`] JSON string."] + description: Returns blockchain state information, as a [`GetBlockChainInfo`] JSON struct. requestBody: required: true content: @@ -549,12 +561,12 @@ paths: schema: type: object properties: + method: + type: string + default: getblockchaininfo id: type: number default: '123' - method: - type: string - default: getbestblockhash params: type: array items: {} @@ -569,17 +581,12 @@ paths: properties: result: type: object - default: '"0000000000000000000000000000000000000000000000000000000000000000"' - /getblocktemplate: + default: '{"chain":"main","blocks":1,"bestblockhash":"0000000000000000000000000000000000000000000000000000000000000000","estimatedheight":1,"upgrades":{},"consensus":{"chaintip":"00000000","nextblock":"00000000"}}' + /getbestblockhash: post: tags: - - mining - description: |- - Returns a block template for mining new Zcash blocks."] - - **Request body `params` arguments:** - - - `jsonrequestobject` - A JSON object containing arguments. + - blockchain + description: Returns the hash of the current best blockchain tip block, as a [`GetBlockHash`] JSON string. requestBody: required: true content: @@ -587,6 +594,9 @@ paths: schema: type: object properties: + method: + type: string + default: getbestblockhash id: type: number default: '123' @@ -594,9 +604,6 @@ paths: type: array items: {} default: '[]' - method: - type: string - default: getblocktemplate responses: '200': description: OK @@ -607,12 +614,17 @@ paths: properties: result: type: object - default: '{}' - /getdifficulty: + default: '"0000000000000000000000000000000000000000000000000000000000000000"' + /z_gettreestate: post: tags: - blockchain - description: Returns the proof-of-work difficulty as a multiple of the minimum difficulty."] + description: |- + Returns information about the given block''s Sapling & Orchard tree state. + + **Request body `params` arguments:** + + - `hash | height` - The block hash or height. requestBody: required: true content: @@ -623,14 +635,24 @@ paths: id: type: number default: '123' + method: + type: string + default: z_gettreestate params: type: array items: {} - default: '[]' - method: - type: string - default: getdifficulty + default: '["00000000febc373a1da2bd9f887b105ad79ddc26ac26c2b28652d64e5207c5b5"]' responses: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters '200': description: OK content: @@ -640,12 +662,17 @@ paths: properties: result: type: object - default: '{}' - /getrawmempool: + default: '{"hash":"0000000000000000000000000000000000000000000000000000000000000000","height":0,"time":0}' + /getblockhash: post: tags: - blockchain - description: Returns all transaction ids in the memory pool, as a JSON array."] + description: |- + Returns the hash of the block of a given height iff the index argument correspond + + **Request body `params` arguments:** + + - `index` - The block index. requestBody: required: true content: @@ -653,16 +680,16 @@ paths: schema: type: object properties: + method: + type: string + default: getblockhash params: type: array items: {} - default: '[]' + default: '[1]' id: type: number default: '123' - method: - type: string - default: getrawmempool responses: '200': description: OK @@ -673,17 +700,27 @@ paths: properties: result: type: object - default: '{}' - /getaddressbalance: + default: '"0000000000000000000000000000000000000000000000000000000000000000"' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getblocktemplate: post: tags: - - address + - mining description: |- - Returns the total balance of a provided `addresses` in an [`AddressBalance`] instance."] + Returns a block template for mining new Zcash blocks. **Request body `params` arguments:** - - `address_strings` - A JSON map with a single entry + - `jsonrequestobject` - A JSON object containing arguments. requestBody: required: true content: @@ -694,13 +731,13 @@ paths: id: type: number default: '123' - method: - type: string - default: getaddressbalance params: type: array items: {} - default: '[{"addresses": ["tmYXBYJj1K7vhejSec5osXK2QsGa5MTisUQ"]}]' + default: '[]' + method: + type: string + default: getblocktemplate responses: '200': description: OK @@ -712,21 +749,16 @@ paths: result: type: object default: '{}' - '400': - description: Bad request - content: - application/json: - schema: - type: object - properties: - error: - type: string - default: Invalid parameters - /getnetworksolps: + /z_validateaddress: post: tags: - - mining - description: Returns the estimated network solutions per second based on the last `num_blocks` before"] + - util + description: |- + Checks if a zcash address is valid. + + **Request body `params` arguments:** + + - `address` - The zcash address to validate. requestBody: required: true content: @@ -743,7 +775,7 @@ paths: default: '123' method: type: string - default: getnetworksolps + default: z_validateaddress responses: '200': description: OK @@ -755,16 +787,11 @@ paths: result: type: object default: '{}' - /z_gettreestate: + /getdifficulty: post: tags: - blockchain - description: |- - Returns information about the given block''s Sapling & Orchard tree state."] - - **Request body `params` arguments:** - - - `hash | height` - The block hash or height. + description: Returns the proof-of-work difficulty as a multiple of the minimum difficulty. requestBody: required: true content: @@ -772,16 +799,16 @@ paths: schema: type: object properties: - id: - type: number - default: '123' params: type: array items: {} - default: '["00000000febc373a1da2bd9f887b105ad79ddc26ac26c2b28652d64e5207c5b5"]' + default: '[]' + id: + type: number + default: '123' method: type: string - default: z_gettreestate + default: getdifficulty responses: '200': description: OK @@ -792,28 +819,17 @@ paths: properties: result: type: object - default: '{"hash":"0000000000000000000000000000000000000000000000000000000000000000","height":0,"time":0}' - '400': - description: Bad request - content: - application/json: - schema: - type: object - properties: - error: - type: string - default: Invalid parameters - /getrawtransaction: + default: '{}' + /z_listunifiedreceivers: post: tags: - - transaction + - wallet description: |- - Returns the raw transaction data, as a [`GetRawTransaction`] JSON string or structure."] + Returns the list of individual payment addresses given a unified address. **Request body `params` arguments:** - - `txid` - The transaction ID of the transaction to be returned. - - `verbose` - If 0, return a string of hex-encoded data, otherwise return a JSON object. + - `address` - The zcash unified address to get the list from. requestBody: required: true content: @@ -821,16 +837,16 @@ paths: schema: type: object properties: + params: + type: array + items: {} + default: '[]' method: type: string - default: getrawtransaction + default: z_listunifiedreceivers id: type: number default: '123' - params: - type: array - items: {} - default: '["mytxid", 1]' responses: '200': description: OK @@ -842,26 +858,11 @@ paths: result: type: object default: '{}' - '400': - description: Bad request - content: - application/json: - schema: - type: object - properties: - error: - type: string - default: Invalid parameters - /z_validateaddress: + /getrawmempool: post: tags: - - util - description: |- - Checks if a zcash address is valid."] - - **Request body `params` arguments:** - - - `address` - The zcash address to validate. + - blockchain + description: Returns all transaction ids in the memory pool, as a JSON array. requestBody: required: true content: @@ -869,6 +870,9 @@ paths: schema: type: object properties: + method: + type: string + default: getrawmempool params: type: array items: {} @@ -876,9 +880,6 @@ paths: id: type: number default: '123' - method: - type: string - default: z_validateaddress responses: '200': description: OK @@ -890,17 +891,11 @@ paths: result: type: object default: '{}' - /getblock: + /getblockcount: post: tags: - blockchain - description: |- - Returns the requested block by hash or height, as a [`GetBlock`] JSON string."] - - **Request body `params` arguments:** - - - `hash_or_height` - The hash or height for the block to be returned. - - `verbosity` - 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data. + description: Returns the height of the most recent block in the best valid block chain (equivalently, requestBody: required: true content: @@ -910,25 +905,15 @@ paths: properties: method: type: string - default: getblock - params: - type: array - items: {} - default: '["1", 1]' + default: getblockcount id: type: number default: '123' + params: + type: array + items: {} + default: '[]' responses: - '400': - description: Bad request - content: - application/json: - schema: - type: object - properties: - error: - type: string - default: Invalid parameters '200': description: OK content: @@ -938,12 +923,17 @@ paths: properties: result: type: object - default: '{"hash":"0000000000000000000000000000000000000000000000000000000000000000","confirmations":0,"tx":[],"trees":{}}' - /getnetworkhashps: + default: '{}' + /sendrawtransaction: post: tags: - - mining - description: Returns the estimated network solutions per second based on the last `num_blocks` before"] + - transaction + description: |- + Sends the raw bytes of a signed transaction to the local node''s mempool, if the transaction is valid. + + **Request body `params` arguments:** + + - `raw_transaction_hex` - The hex-encoded raw transaction bytes. requestBody: required: true content: @@ -951,16 +941,16 @@ paths: schema: type: object properties: + id: + type: number + default: '123' params: type: array items: {} - default: '[]' + default: '["signedhex"]' method: type: string - default: getnetworkhashps - id: - type: number - default: '123' + default: sendrawtransaction responses: '200': description: OK @@ -972,11 +962,21 @@ paths: result: type: object default: '{}' - /getblockchaininfo: + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + default: Invalid parameters + /getinfo: post: tags: - - blockchain - description: Returns blockchain state information, as a [`GetBlockChainInfo`] JSON struct."] + - control + description: Returns software information from the RPC server, as a [`GetInfo`] JSON struct. requestBody: required: true content: @@ -986,7 +986,7 @@ paths: properties: method: type: string - default: getblockchaininfo + default: getinfo id: type: number default: '123' @@ -1004,4 +1004,4 @@ paths: properties: result: type: object - default: '{"chain":"main","blocks":1,"bestblockhash":"0000000000000000000000000000000000000000000000000000000000000000","estimatedheight":1,"upgrades":{},"consensus":{"chaintip":"00000000","nextblock":"00000000"}}' + default: '{"build":"some build version","subversion":"some subversion"}' diff --git a/zebra-utils/src/bin/openapi-generator/main.rs b/zebra-utils/src/bin/openapi-generator/main.rs index 020c166534b..5c5683a3b57 100644 --- a/zebra-utils/src/bin/openapi-generator/main.rs +++ b/zebra-utils/src/bin/openapi-generator/main.rs @@ -244,7 +244,7 @@ fn method_doc(method: &syn::TraitItem) -> Result<(Vec, String), Box return Err("Description not found in method documentation".into()), }; - Ok((method_doc, description)) + Ok((method_doc, description.trim_end_matches("\"]").to_string())) } // Extract the tags from the method documentation. TODO: Assuming 1 tag per method for now