From 46fbbbd77d8b75cccad76f73cdf685457cdb30e9 Mon Sep 17 00:00:00 2001 From: Pavitthra Pandurangan Date: Thu, 29 Jul 2021 13:19:31 -0400 Subject: [PATCH] docs: changed type of query parameter to boolean in the openapi doc --- docs/rpc/openapi.yaml | 43 ++++++++++++++++++++++--------------------- src/net/http.rs | 4 ++-- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/rpc/openapi.yaml b/docs/rpc/openapi.yaml index 8a3c78122..f85dcfe4f 100644 --- a/docs/rpc/openapi.yaml +++ b/docs/rpc/openapi.yaml @@ -77,10 +77,10 @@ paths: - name: use_latest_tip in: query schema: - type: string + type: boolean description: | - If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). /v2/map_entry/{contract_address}/{contract_name}/{map_name}: post: @@ -137,10 +137,10 @@ paths: - name: use_latest_tip in: query schema: - type: string + type: boolean description: | - If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). x-codegen-request-body-name: key requestBody: @@ -194,9 +194,10 @@ paths: - name: use_latest_tip in: query schema: - type: string - description: If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + type: boolean + description: | + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). /v2/contracts/call-read/{contract_address}/{contract_name}/{function_name}: @@ -249,10 +250,10 @@ paths: - name: use_latest_tip in: query schema: - type: string + type: boolean description: | - If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). requestBody: description: map of arguments and the simulated tx-sender where sender is either a Contract identifier or a normal Stacks address, and arguments is an array of hex serialized Clarity values. @@ -299,10 +300,10 @@ paths: - name: use_latest_tip in: query schema: - type: string + type: boolean description: | - If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). responses: 200: @@ -373,10 +374,10 @@ paths: - name: use_latest_tip in: query schema: - type: string + type: boolean description: | - If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). /v2/traits/{contract_address}/{contract_name}/{trait_contract_address}/{trait_ contract_name}/{trait_name}: @@ -434,8 +435,8 @@ paths: - name: use_latest_tip in: query schema: - type: string + type: boolean description: | - If use_latest_tip == 1, the query will be run from the latest tip (includes unconfirmed state). - If use_latest_tip == 0 or is unspecified, the tip is selected as usual (first checking value of the + If use_latest_tip == true, the query will be run from the latest tip (includes unconfirmed state). + If use_latest_tip == false or is unspecified, the tip is selected as usual (first checking value of the tip parameter, otherwise taking the stacks chain tip). diff --git a/src/net/http.rs b/src/net/http.rs index f99d33932..34ad2b887 100644 --- a/src/net/http.rs +++ b/src/net/http.rs @@ -1681,7 +1681,7 @@ impl HttpRequestType { if let Some(query_string) = query { form_urlencoded::parse(query_string.as_bytes()) .find(|(key, _v)| key == "use_latest_tip") - .map(|(_k, value)| value == "1") + .map(|(_k, value)| value == "1" || value == "true") .unwrap_or(false) } else { false @@ -2502,7 +2502,7 @@ impl HttpRequestType { ) -> String { if use_latest_tip { format!( - "?use_latest_tip=1{}", + "?use_latest_tip=true{}", if with_proof { "" } else { "&proof=0" } ) } else if let Some(tip) = tip_opt {