From 2a8e70b505d9a9482a419b53f6fbb507cb01615b Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Thu, 4 Mar 2021 16:15:58 -0600 Subject: [PATCH 1/3] Fixed documentation to match the current code behavior. --- plugins/chain_api_plugin/chain.swagger.yaml | 24 ++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/plugins/chain_api_plugin/chain.swagger.yaml b/plugins/chain_api_plugin/chain.swagger.yaml index 94efe377c0d..eb906ac3eea 100644 --- a/plugins/chain_api_plugin/chain.swagger.yaml +++ b/plugins/chain_api_plugin/chain.swagger.yaml @@ -573,23 +573,26 @@ paths: description: The name of primary or secondary index encode_type: type: string ( 'bytes' for arbitray binary index value ) - description: Type of key specified by index_position (for example - `uint64_t` or `name`) + description: Encoding type to use for index_value, lower_bound, and upper_bound. Valid values are "bytes", "string", "name", "dec", or "hex"'. If not provided, the appropriate value based on the index_name's abi indicated type, for integers "dec" is the default. "bytes" can be used for any type of field. Example values for each type "bytes" => "0000000000000e1a", "string" => "Some value!", "name" => "eosio", "dec" => "3610", and "hex" => "e1a". index_value: type: string - description: index value used for point query encoded as 'encode_type' + description: index value used for point query encoded as 'encode_type'. Cannot be used with either lower_bound or upper_bound. lower_bound: type: string - description: lower bound index value for ranged query. Query result includes rows specified with lower_bound + description: lower bound index value for ranged query. Query result includes rows specified with lower_bound. Cannot be used with index_value. If index_name and lower_bound are not provided, then lower_bound is defaulted to be the lowest value in the table for that index_name. upper_bound: type: string - description: upper bound index value for ranged query. Query result doesn't include rows specified with upper_bound + description: upper bound index value for ranged query. Query result includes rows specified with upper_bound. Cannot be used with index_value. If index_name and upper_bound are not provided, then lower_bound is defaulted to be the highest value in the table for that index_name. limit: type: integer - description: Limit number of results returned. + description: Limit number of results returned format: int32 reverse: type: boolean description: Reverse the order of returned results + show_payer: + type: boolean + description: Provide the ram payer for each row responses: "200": description: OK @@ -597,10 +600,21 @@ paths: application/json: schema: type: object + required: + - rows properties: rows: type: array items: {} + more: + type: boolean + description: Indicates if the entire request was not fulfilled and a subsequent query must be performed. If more is True, then "next_key" and "next_key_bytes" will be provided. + next_key: + type: string + description: Indicates the value to provide for next query to retrieve the next range of rows to complete the query. The original query should be reused, but substituting next_key's value for lower_bound, if reverse is False or not provided, otherwise it should be substituted for upper_bound. + next_key_bytes: + type: string + description: This is the same value as next_key except encoded as "bytes". It can be used in the same way, except the original query would also need its encode_type replaced with "bytes". This likely only would be used if upper_bound is not provided (or reverse set True and lower_bound is not provided), since both lower_bound and upper_bound would need to be provided as "bytes". /abi_json_to_bin: post: From bf5a9231f0373595587921a34c14227933a3de89 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Thu, 4 Mar 2021 16:34:25 -0600 Subject: [PATCH 2/3] Fixed errors pointed out in PR. --- plugins/chain_api_plugin/chain.swagger.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/chain_api_plugin/chain.swagger.yaml b/plugins/chain_api_plugin/chain.swagger.yaml index eb906ac3eea..badc852dffe 100644 --- a/plugins/chain_api_plugin/chain.swagger.yaml +++ b/plugins/chain_api_plugin/chain.swagger.yaml @@ -573,16 +573,16 @@ paths: description: The name of primary or secondary index encode_type: type: string ( 'bytes' for arbitray binary index value ) - description: Encoding type to use for index_value, lower_bound, and upper_bound. Valid values are "bytes", "string", "name", "dec", or "hex"'. If not provided, the appropriate value based on the index_name's abi indicated type, for integers "dec" is the default. "bytes" can be used for any type of field. Example values for each type "bytes" => "0000000000000e1a", "string" => "Some value!", "name" => "eosio", "dec" => "3610", and "hex" => "e1a". + description: Encoding type to use for index_value, lower_bound, and upper_bound. Valid values are "bytes", "string", "name", "dec", or "hex"'. If not provided, the appropriate value based on the index_name's abi indicated type, for integers "dec" is the default. "bytes" are encoded as hexidecimal strings and can be used for any type of field. Example values for each type "bytes" => "0000000000000e1a", "string" => "Some value!", "name" => "eosio", "dec" => "3610", and "hex" => "e1a". index_value: type: string description: index value used for point query encoded as 'encode_type'. Cannot be used with either lower_bound or upper_bound. lower_bound: type: string - description: lower bound index value for ranged query. Query result includes rows specified with lower_bound. Cannot be used with index_value. If index_name and lower_bound are not provided, then lower_bound is defaulted to be the lowest value in the table for that index_name. + description: lower bound index value for ranged query. Query result includes rows specified with lower_bound. Cannot be used with index_value. If index_value and lower_bound are not provided, then lower_bound is defaulted to be the lowest value in the table for that index_name. upper_bound: type: string - description: upper bound index value for ranged query. Query result includes rows specified with upper_bound. Cannot be used with index_value. If index_name and upper_bound are not provided, then lower_bound is defaulted to be the highest value in the table for that index_name. + description: upper bound index value for ranged query. Query result includes rows specified with upper_bound. Cannot be used with index_value. If index_value and upper_bound are not provided, then upper_bound is defaulted to be the highest value in the table for that index_name. limit: type: integer description: Limit number of results returned From 505e9a2c483c526af8e283b4132b3fe7585d1c69 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Thu, 4 Mar 2021 16:54:15 -0600 Subject: [PATCH 3/3] More cleanup from PR. --- plugins/chain_api_plugin/chain.swagger.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/chain_api_plugin/chain.swagger.yaml b/plugins/chain_api_plugin/chain.swagger.yaml index badc852dffe..bc127db61f7 100644 --- a/plugins/chain_api_plugin/chain.swagger.yaml +++ b/plugins/chain_api_plugin/chain.swagger.yaml @@ -576,13 +576,13 @@ paths: description: Encoding type to use for index_value, lower_bound, and upper_bound. Valid values are "bytes", "string", "name", "dec", or "hex"'. If not provided, the appropriate value based on the index_name's abi indicated type, for integers "dec" is the default. "bytes" are encoded as hexidecimal strings and can be used for any type of field. Example values for each type "bytes" => "0000000000000e1a", "string" => "Some value!", "name" => "eosio", "dec" => "3610", and "hex" => "e1a". index_value: type: string - description: index value used for point query encoded as 'encode_type'. Cannot be used with either lower_bound or upper_bound. + description: Index value used for point query encoded as 'encode_type'. Cannot be used with either lower_bound or upper_bound. lower_bound: type: string - description: lower bound index value for ranged query. Query result includes rows specified with lower_bound. Cannot be used with index_value. If index_value and lower_bound are not provided, then lower_bound is defaulted to be the lowest value in the table for that index_name. + description: Lower bound index value for ranged query. Query result includes rows specified with lower_bound. Cannot be used with index_value. If index_value and lower_bound are not provided, then lower_bound is defaulted to be the lowest value in the table for that index_name. upper_bound: type: string - description: upper bound index value for ranged query. Query result includes rows specified with upper_bound. Cannot be used with index_value. If index_value and upper_bound are not provided, then upper_bound is defaulted to be the highest value in the table for that index_name. + description: Upper bound index value for ranged query. Query result includes rows specified with upper_bound. Cannot be used with index_value. If index_value and upper_bound are not provided, then upper_bound is defaulted to be the highest value in the table for that index_name. limit: type: integer description: Limit number of results returned @@ -614,7 +614,7 @@ paths: description: Indicates the value to provide for next query to retrieve the next range of rows to complete the query. The original query should be reused, but substituting next_key's value for lower_bound, if reverse is False or not provided, otherwise it should be substituted for upper_bound. next_key_bytes: type: string - description: This is the same value as next_key except encoded as "bytes". It can be used in the same way, except the original query would also need its encode_type replaced with "bytes". This likely only would be used if upper_bound is not provided (or reverse set True and lower_bound is not provided), since both lower_bound and upper_bound would need to be provided as "bytes". + description: This is the same value as next_key except encoded as "bytes". It can be used in the same way, except the original query would also need its encode_type replaced with "bytes". /abi_json_to_bin: post: