forked from loafle/openapi-generator-original
* replace http with https. Replace http://central.maven.org with https://repo1.maven.org * replace http://www.apache.org/licenses/LICENSE-2.0 with https://www.apache.org/licenses/LICENSE-2.0 * Force HTTPS for mavenCentral gradle DSL Co-authored-by: Sebastien Rosset <serosset@cisco.com>
4004 lines
158 KiB
Bash
4004 lines
158 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
# !
|
|
# ! Note:
|
|
# !
|
|
# ! THIS SCRIPT HAS BEEN AUTOMATICALLY GENERATED USING
|
|
# ! openapi-generator (https://openapi-generator.tech)
|
|
# ! FROM OPENAPI SPECIFICATION IN JSON.
|
|
# !
|
|
# !
|
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
#
|
|
# This is a Bash client for OpenAPI Petstore.
|
|
#
|
|
# LICENSE:
|
|
# https://www.apache.org/licenses/LICENSE-2.0.html
|
|
#
|
|
# CONTACT:
|
|
#
|
|
#
|
|
# MORE INFORMATION:
|
|
#
|
|
#
|
|
|
|
# For improved pattern matching in case statemets
|
|
shopt -s extglob
|
|
|
|
###############################################################################
|
|
#
|
|
# Make sure Bash is at least in version 4.3
|
|
#
|
|
###############################################################################
|
|
if ! ( (("${BASH_VERSION:0:1}" == "4")) && (("${BASH_VERSION:2:1}" >= "3")) ) \
|
|
&& ! (("${BASH_VERSION:0:1}" >= "5")); then
|
|
echo ""
|
|
echo "Sorry - your Bash version is ${BASH_VERSION}"
|
|
echo ""
|
|
echo "You need at least Bash 4.3 to run this script."
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
###############################################################################
|
|
#
|
|
# Global variables
|
|
#
|
|
###############################################################################
|
|
|
|
##
|
|
# The filename of this script for help messages
|
|
script_name=$(basename "$0")
|
|
|
|
##
|
|
# Map for headers passed after operation as KEY:VALUE
|
|
declare -A header_arguments
|
|
|
|
|
|
##
|
|
# Map for operation parameters passed after operation as PARAMETER=VALUE
|
|
# These will be mapped to appropriate path or query parameters
|
|
# The values in operation_parameters are arrays, so that multiple values
|
|
# can be provided for the same parameter if allowed by API specification
|
|
declare -A operation_parameters
|
|
|
|
##
|
|
# Declare colors with autodection if output is terminal
|
|
if [ -t 1 ]; then
|
|
RED="$(tput setaf 1)"
|
|
GREEN="$(tput setaf 2)"
|
|
YELLOW="$(tput setaf 3)"
|
|
BLUE="$(tput setaf 4)"
|
|
MAGENTA="$(tput setaf 5)"
|
|
CYAN="$(tput setaf 6)"
|
|
WHITE="$(tput setaf 7)"
|
|
BOLD="$(tput bold)"
|
|
OFF="$(tput sgr0)"
|
|
else
|
|
RED=""
|
|
GREEN=""
|
|
YELLOW=""
|
|
BLUE=""
|
|
MAGENTA=""
|
|
CYAN=""
|
|
WHITE=""
|
|
BOLD=""
|
|
OFF=""
|
|
fi
|
|
|
|
declare -a result_color_table=( "$WHITE" "$WHITE" "$GREEN" "$YELLOW" "$WHITE" "$MAGENTA" "$WHITE" )
|
|
|
|
##
|
|
# This array stores the minimum number of required occurrences for parameter
|
|
# 0 - optional
|
|
# 1 - required
|
|
declare -A operation_parameters_minimum_occurrences
|
|
operation_parameters_minimum_occurrences["123Test@$%SpecialTags:::Client"]=1
|
|
operation_parameters_minimum_occurrences["fakeOuterBooleanSerialize:::body"]=0
|
|
operation_parameters_minimum_occurrences["fakeOuterCompositeSerialize:::OuterComposite"]=0
|
|
operation_parameters_minimum_occurrences["fakeOuterNumberSerialize:::body"]=0
|
|
operation_parameters_minimum_occurrences["fakeOuterStringSerialize:::body"]=0
|
|
operation_parameters_minimum_occurrences["testBodyWithFileSchema:::FileSchemaTestClass"]=1
|
|
operation_parameters_minimum_occurrences["testBodyWithQueryParams:::query"]=1
|
|
operation_parameters_minimum_occurrences["testBodyWithQueryParams:::User"]=1
|
|
operation_parameters_minimum_occurrences["testClientModel:::Client"]=1
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::number"]=1
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::double"]=1
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::pattern_without_delimiter"]=1
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::byte"]=1
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::integer"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::int32"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::int64"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::float"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::string"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::binary"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::date"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::dateTime"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::password"]=0
|
|
operation_parameters_minimum_occurrences["testEndpointParameters:::callback"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_header_string_array"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_header_string"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_query_string_array"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_query_string"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_query_integer"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_query_double"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_form_string_array"]=0
|
|
operation_parameters_minimum_occurrences["testEnumParameters:::enum_form_string"]=0
|
|
operation_parameters_minimum_occurrences["testGroupParameters:::required_string_group"]=1
|
|
operation_parameters_minimum_occurrences["testGroupParameters:::required_boolean_group"]=1
|
|
operation_parameters_minimum_occurrences["testGroupParameters:::required_int64_group"]=1
|
|
operation_parameters_minimum_occurrences["testGroupParameters:::string_group"]=0
|
|
operation_parameters_minimum_occurrences["testGroupParameters:::boolean_group"]=0
|
|
operation_parameters_minimum_occurrences["testGroupParameters:::int64_group"]=0
|
|
operation_parameters_minimum_occurrences["testInlineAdditionalProperties:::request_body"]=1
|
|
operation_parameters_minimum_occurrences["testJsonFormData:::param"]=1
|
|
operation_parameters_minimum_occurrences["testJsonFormData:::param2"]=1
|
|
operation_parameters_minimum_occurrences["testClassname:::Client"]=1
|
|
operation_parameters_minimum_occurrences["addPet:::Pet"]=1
|
|
operation_parameters_minimum_occurrences["deletePet:::petId"]=1
|
|
operation_parameters_minimum_occurrences["deletePet:::api_key"]=0
|
|
operation_parameters_minimum_occurrences["findPetsByStatus:::status"]=1
|
|
operation_parameters_minimum_occurrences["findPetsByTags:::tags"]=1
|
|
operation_parameters_minimum_occurrences["getPetById:::petId"]=1
|
|
operation_parameters_minimum_occurrences["updatePet:::Pet"]=1
|
|
operation_parameters_minimum_occurrences["updatePetWithForm:::petId"]=1
|
|
operation_parameters_minimum_occurrences["updatePetWithForm:::name"]=0
|
|
operation_parameters_minimum_occurrences["updatePetWithForm:::status"]=0
|
|
operation_parameters_minimum_occurrences["uploadFile:::petId"]=1
|
|
operation_parameters_minimum_occurrences["uploadFile:::additionalMetadata"]=0
|
|
operation_parameters_minimum_occurrences["uploadFile:::file"]=0
|
|
operation_parameters_minimum_occurrences["uploadFileWithRequiredFile:::petId"]=1
|
|
operation_parameters_minimum_occurrences["uploadFileWithRequiredFile:::requiredFile"]=1
|
|
operation_parameters_minimum_occurrences["uploadFileWithRequiredFile:::additionalMetadata"]=0
|
|
operation_parameters_minimum_occurrences["deleteOrder:::order_id"]=1
|
|
operation_parameters_minimum_occurrences["getOrderById:::order_id"]=1
|
|
operation_parameters_minimum_occurrences["placeOrder:::Order"]=1
|
|
operation_parameters_minimum_occurrences["createUser:::User"]=1
|
|
operation_parameters_minimum_occurrences["createUsersWithArrayInput:::User"]=1
|
|
operation_parameters_minimum_occurrences["createUsersWithListInput:::User"]=1
|
|
operation_parameters_minimum_occurrences["deleteUser:::username"]=1
|
|
operation_parameters_minimum_occurrences["getUserByName:::username"]=1
|
|
operation_parameters_minimum_occurrences["loginUser:::username"]=1
|
|
operation_parameters_minimum_occurrences["loginUser:::password"]=1
|
|
operation_parameters_minimum_occurrences["updateUser:::username"]=1
|
|
operation_parameters_minimum_occurrences["updateUser:::User"]=1
|
|
|
|
##
|
|
# This array stores the maximum number of allowed occurrences for parameter
|
|
# 1 - single value
|
|
# 2 - 2 values
|
|
# N - N values
|
|
# 0 - unlimited
|
|
declare -A operation_parameters_maximum_occurrences
|
|
operation_parameters_maximum_occurrences["123Test@$%SpecialTags:::Client"]=0
|
|
operation_parameters_maximum_occurrences["fakeOuterBooleanSerialize:::body"]=0
|
|
operation_parameters_maximum_occurrences["fakeOuterCompositeSerialize:::OuterComposite"]=0
|
|
operation_parameters_maximum_occurrences["fakeOuterNumberSerialize:::body"]=0
|
|
operation_parameters_maximum_occurrences["fakeOuterStringSerialize:::body"]=0
|
|
operation_parameters_maximum_occurrences["testBodyWithFileSchema:::FileSchemaTestClass"]=0
|
|
operation_parameters_maximum_occurrences["testBodyWithQueryParams:::query"]=0
|
|
operation_parameters_maximum_occurrences["testBodyWithQueryParams:::User"]=0
|
|
operation_parameters_maximum_occurrences["testClientModel:::Client"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::number"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::double"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::pattern_without_delimiter"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::byte"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::integer"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::int32"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::int64"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::float"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::string"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::binary"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::date"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::dateTime"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::password"]=0
|
|
operation_parameters_maximum_occurrences["testEndpointParameters:::callback"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_header_string_array"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_header_string"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_query_string_array"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_query_string"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_query_integer"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_query_double"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_form_string_array"]=0
|
|
operation_parameters_maximum_occurrences["testEnumParameters:::enum_form_string"]=0
|
|
operation_parameters_maximum_occurrences["testGroupParameters:::required_string_group"]=0
|
|
operation_parameters_maximum_occurrences["testGroupParameters:::required_boolean_group"]=0
|
|
operation_parameters_maximum_occurrences["testGroupParameters:::required_int64_group"]=0
|
|
operation_parameters_maximum_occurrences["testGroupParameters:::string_group"]=0
|
|
operation_parameters_maximum_occurrences["testGroupParameters:::boolean_group"]=0
|
|
operation_parameters_maximum_occurrences["testGroupParameters:::int64_group"]=0
|
|
operation_parameters_maximum_occurrences["testInlineAdditionalProperties:::request_body"]=0
|
|
operation_parameters_maximum_occurrences["testJsonFormData:::param"]=0
|
|
operation_parameters_maximum_occurrences["testJsonFormData:::param2"]=0
|
|
operation_parameters_maximum_occurrences["testClassname:::Client"]=0
|
|
operation_parameters_maximum_occurrences["addPet:::Pet"]=0
|
|
operation_parameters_maximum_occurrences["deletePet:::petId"]=0
|
|
operation_parameters_maximum_occurrences["deletePet:::api_key"]=0
|
|
operation_parameters_maximum_occurrences["findPetsByStatus:::status"]=0
|
|
operation_parameters_maximum_occurrences["findPetsByTags:::tags"]=0
|
|
operation_parameters_maximum_occurrences["getPetById:::petId"]=0
|
|
operation_parameters_maximum_occurrences["updatePet:::Pet"]=0
|
|
operation_parameters_maximum_occurrences["updatePetWithForm:::petId"]=0
|
|
operation_parameters_maximum_occurrences["updatePetWithForm:::name"]=0
|
|
operation_parameters_maximum_occurrences["updatePetWithForm:::status"]=0
|
|
operation_parameters_maximum_occurrences["uploadFile:::petId"]=0
|
|
operation_parameters_maximum_occurrences["uploadFile:::additionalMetadata"]=0
|
|
operation_parameters_maximum_occurrences["uploadFile:::file"]=0
|
|
operation_parameters_maximum_occurrences["uploadFileWithRequiredFile:::petId"]=0
|
|
operation_parameters_maximum_occurrences["uploadFileWithRequiredFile:::requiredFile"]=0
|
|
operation_parameters_maximum_occurrences["uploadFileWithRequiredFile:::additionalMetadata"]=0
|
|
operation_parameters_maximum_occurrences["deleteOrder:::order_id"]=0
|
|
operation_parameters_maximum_occurrences["getOrderById:::order_id"]=0
|
|
operation_parameters_maximum_occurrences["placeOrder:::Order"]=0
|
|
operation_parameters_maximum_occurrences["createUser:::User"]=0
|
|
operation_parameters_maximum_occurrences["createUsersWithArrayInput:::User"]=0
|
|
operation_parameters_maximum_occurrences["createUsersWithListInput:::User"]=0
|
|
operation_parameters_maximum_occurrences["deleteUser:::username"]=0
|
|
operation_parameters_maximum_occurrences["getUserByName:::username"]=0
|
|
operation_parameters_maximum_occurrences["loginUser:::username"]=0
|
|
operation_parameters_maximum_occurrences["loginUser:::password"]=0
|
|
operation_parameters_maximum_occurrences["updateUser:::username"]=0
|
|
operation_parameters_maximum_occurrences["updateUser:::User"]=0
|
|
|
|
##
|
|
# The type of collection for specifying multiple values for parameter:
|
|
# - multi, csv, ssv, tsv
|
|
declare -A operation_parameters_collection_type
|
|
operation_parameters_collection_type["123Test@$%SpecialTags:::Client"]=""
|
|
operation_parameters_collection_type["fakeOuterBooleanSerialize:::body"]=""
|
|
operation_parameters_collection_type["fakeOuterCompositeSerialize:::OuterComposite"]=""
|
|
operation_parameters_collection_type["fakeOuterNumberSerialize:::body"]=""
|
|
operation_parameters_collection_type["fakeOuterStringSerialize:::body"]=""
|
|
operation_parameters_collection_type["testBodyWithFileSchema:::FileSchemaTestClass"]=""
|
|
operation_parameters_collection_type["testBodyWithQueryParams:::query"]=""
|
|
operation_parameters_collection_type["testBodyWithQueryParams:::User"]=""
|
|
operation_parameters_collection_type["testClientModel:::Client"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::number"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::double"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::pattern_without_delimiter"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::byte"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::integer"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::int32"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::int64"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::float"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::string"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::binary"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::date"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::dateTime"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::password"]=""
|
|
operation_parameters_collection_type["testEndpointParameters:::callback"]=""
|
|
operation_parameters_collection_type["testEnumParameters:::enum_header_string_array"]="csv"
|
|
operation_parameters_collection_type["testEnumParameters:::enum_header_string"]=""
|
|
operation_parameters_collection_type["testEnumParameters:::enum_query_string_array"]="multi"
|
|
operation_parameters_collection_type["testEnumParameters:::enum_query_string"]=""
|
|
operation_parameters_collection_type["testEnumParameters:::enum_query_integer"]=""
|
|
operation_parameters_collection_type["testEnumParameters:::enum_query_double"]=""
|
|
operation_parameters_collection_type["testEnumParameters:::enum_form_string_array"]=
|
|
operation_parameters_collection_type["testEnumParameters:::enum_form_string"]=""
|
|
operation_parameters_collection_type["testGroupParameters:::required_string_group"]=""
|
|
operation_parameters_collection_type["testGroupParameters:::required_boolean_group"]=""
|
|
operation_parameters_collection_type["testGroupParameters:::required_int64_group"]=""
|
|
operation_parameters_collection_type["testGroupParameters:::string_group"]=""
|
|
operation_parameters_collection_type["testGroupParameters:::boolean_group"]=""
|
|
operation_parameters_collection_type["testGroupParameters:::int64_group"]=""
|
|
operation_parameters_collection_type["testInlineAdditionalProperties:::request_body"]=
|
|
operation_parameters_collection_type["testJsonFormData:::param"]=""
|
|
operation_parameters_collection_type["testJsonFormData:::param2"]=""
|
|
operation_parameters_collection_type["testClassname:::Client"]=""
|
|
operation_parameters_collection_type["addPet:::Pet"]=""
|
|
operation_parameters_collection_type["deletePet:::petId"]=""
|
|
operation_parameters_collection_type["deletePet:::api_key"]=""
|
|
operation_parameters_collection_type["findPetsByStatus:::status"]="csv"
|
|
operation_parameters_collection_type["findPetsByTags:::tags"]="csv"
|
|
operation_parameters_collection_type["getPetById:::petId"]=""
|
|
operation_parameters_collection_type["updatePet:::Pet"]=""
|
|
operation_parameters_collection_type["updatePetWithForm:::petId"]=""
|
|
operation_parameters_collection_type["updatePetWithForm:::name"]=""
|
|
operation_parameters_collection_type["updatePetWithForm:::status"]=""
|
|
operation_parameters_collection_type["uploadFile:::petId"]=""
|
|
operation_parameters_collection_type["uploadFile:::additionalMetadata"]=""
|
|
operation_parameters_collection_type["uploadFile:::file"]=""
|
|
operation_parameters_collection_type["uploadFileWithRequiredFile:::petId"]=""
|
|
operation_parameters_collection_type["uploadFileWithRequiredFile:::requiredFile"]=""
|
|
operation_parameters_collection_type["uploadFileWithRequiredFile:::additionalMetadata"]=""
|
|
operation_parameters_collection_type["deleteOrder:::order_id"]=""
|
|
operation_parameters_collection_type["getOrderById:::order_id"]=""
|
|
operation_parameters_collection_type["placeOrder:::Order"]=""
|
|
operation_parameters_collection_type["createUser:::User"]=""
|
|
operation_parameters_collection_type["createUsersWithArrayInput:::User"]=
|
|
operation_parameters_collection_type["createUsersWithListInput:::User"]=
|
|
operation_parameters_collection_type["deleteUser:::username"]=""
|
|
operation_parameters_collection_type["getUserByName:::username"]=""
|
|
operation_parameters_collection_type["loginUser:::username"]=""
|
|
operation_parameters_collection_type["loginUser:::password"]=""
|
|
operation_parameters_collection_type["updateUser:::username"]=""
|
|
operation_parameters_collection_type["updateUser:::User"]=""
|
|
|
|
|
|
##
|
|
# Map for body parameters passed after operation as
|
|
# PARAMETER==STRING_VALUE or PARAMETER:=NUMERIC_VALUE
|
|
# These will be mapped to top level json keys ( { "PARAMETER": "VALUE" })
|
|
declare -A body_parameters
|
|
|
|
##
|
|
# These arguments will be directly passed to cURL
|
|
curl_arguments=""
|
|
|
|
##
|
|
# The host for making the request
|
|
host=""
|
|
|
|
##
|
|
# The user credentials for basic authentication
|
|
basic_auth_credential=""
|
|
|
|
##
|
|
# The user API key
|
|
apikey_auth_credential=""
|
|
|
|
##
|
|
# If true, the script will only output the actual cURL command that would be
|
|
# used
|
|
print_curl=false
|
|
|
|
##
|
|
# The operation ID passed on the command line
|
|
operation=""
|
|
|
|
##
|
|
# The provided Accept header value
|
|
header_accept=""
|
|
|
|
##
|
|
# The provided Content-type header value
|
|
header_content_type=""
|
|
|
|
##
|
|
# If there is any body content on the stdin pass it to the body of the request
|
|
body_content_temp_file=""
|
|
|
|
##
|
|
# If this variable is set to true, the request will be performed even
|
|
# if parameters for required query, header or body values are not provided
|
|
# (path parameters are still required).
|
|
force=false
|
|
|
|
##
|
|
# Declare some mime types abbreviations for easier content-type and accepts
|
|
# headers specification
|
|
declare -A mime_type_abbreviations
|
|
# text/*
|
|
mime_type_abbreviations["text"]="text/plain"
|
|
mime_type_abbreviations["html"]="text/html"
|
|
mime_type_abbreviations["md"]="text/x-markdown"
|
|
mime_type_abbreviations["csv"]="text/csv"
|
|
mime_type_abbreviations["css"]="text/css"
|
|
mime_type_abbreviations["rtf"]="text/rtf"
|
|
# application/*
|
|
mime_type_abbreviations["json"]="application/json"
|
|
mime_type_abbreviations["xml"]="application/xml"
|
|
mime_type_abbreviations["yaml"]="application/yaml"
|
|
mime_type_abbreviations["js"]="application/javascript"
|
|
mime_type_abbreviations["bin"]="application/octet-stream"
|
|
mime_type_abbreviations["rdf"]="application/rdf+xml"
|
|
# image/*
|
|
mime_type_abbreviations["jpg"]="image/jpeg"
|
|
mime_type_abbreviations["png"]="image/png"
|
|
mime_type_abbreviations["gif"]="image/gif"
|
|
mime_type_abbreviations["bmp"]="image/bmp"
|
|
mime_type_abbreviations["tiff"]="image/tiff"
|
|
|
|
|
|
##############################################################################
|
|
#
|
|
# Escape special URL characters
|
|
# Based on table at http://www.w3schools.com/tags/ref_urlencode.asp
|
|
#
|
|
##############################################################################
|
|
url_escape() {
|
|
local raw_url="$1"
|
|
|
|
value=$(sed -e 's/ /%20/g' \
|
|
-e 's/!/%21/g' \
|
|
-e 's/"/%22/g' \
|
|
-e 's/#/%23/g' \
|
|
-e 's/\&/%26/g' \
|
|
-e 's/'\''/%28/g' \
|
|
-e 's/(/%28/g' \
|
|
-e 's/)/%29/g' \
|
|
-e 's/:/%3A/g' \
|
|
-e 's/\t/%09/g' \
|
|
-e 's/?/%3F/g' <<<"$raw_url");
|
|
|
|
echo "$value"
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Lookup the mime type abbreviation in the mime_type_abbreviations array.
|
|
# If not present assume the user provided a valid mime type
|
|
#
|
|
##############################################################################
|
|
lookup_mime_type() {
|
|
local mime_type="$1"
|
|
|
|
if [[ ${mime_type_abbreviations[$mime_type]} ]]; then
|
|
echo "${mime_type_abbreviations[$mime_type]}"
|
|
else
|
|
echo "$mime_type"
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Converts an associative array into a list of cURL header
|
|
# arguments (-H "KEY: VALUE")
|
|
#
|
|
##############################################################################
|
|
header_arguments_to_curl() {
|
|
local headers_curl=""
|
|
local api_key_header=""
|
|
local api_key_header_in_cli=""
|
|
api_key_header="api_key"
|
|
|
|
for key in "${!header_arguments[@]}"; do
|
|
headers_curl+="-H \"${key}: ${header_arguments[${key}]}\" "
|
|
if [[ "${key}XX" == "${api_key_header}XX" ]]; then
|
|
api_key_header_in_cli="YES"
|
|
fi
|
|
done
|
|
#
|
|
# If the api_key was not provided in the header, try one from the
|
|
# environment variable
|
|
#
|
|
if [[ -z $api_key_header_in_cli && -n $apikey_auth_credential ]]; then
|
|
headers_curl+="-H \"${api_key_header}: ${apikey_auth_credential}\""
|
|
fi
|
|
headers_curl+=" "
|
|
|
|
echo "${headers_curl}"
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Converts an associative array into a simple JSON with keys as top
|
|
# level object attributes
|
|
#
|
|
# \todo Add conversion of more complex attributes using paths
|
|
#
|
|
##############################################################################
|
|
body_parameters_to_json() {
|
|
local body_json="-d '{"
|
|
local count=0
|
|
for key in "${!body_parameters[@]}"; do
|
|
if [[ $((count++)) -gt 0 ]]; then
|
|
body_json+=", "
|
|
fi
|
|
body_json+="\"${key}\": ${body_parameters[${key}]}"
|
|
done
|
|
body_json+="}'"
|
|
|
|
if [[ "${#body_parameters[@]}" -eq 0 ]]; then
|
|
echo ""
|
|
else
|
|
echo "${body_json}"
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Helper method for showing error because for example echo in
|
|
# build_request_path() is evaluated as part of command line not printed on
|
|
# output. Anyway better idea for resource clean up ;-).
|
|
#
|
|
##############################################################################
|
|
ERROR_MSG=""
|
|
function finish {
|
|
if [[ -n "$ERROR_MSG" ]]; then
|
|
echo >&2 "${OFF}${RED}$ERROR_MSG"
|
|
echo >&2 "${OFF}Check usage: '${script_name} --help'"
|
|
fi
|
|
}
|
|
trap finish EXIT
|
|
|
|
|
|
##############################################################################
|
|
#
|
|
# Validate and build request path including query parameters
|
|
#
|
|
##############################################################################
|
|
build_request_path() {
|
|
local path_template=$1
|
|
local -n path_params=$2
|
|
local -n query_params=$3
|
|
|
|
|
|
#
|
|
# Check input parameters count against minimum and maximum required
|
|
#
|
|
if [[ "$force" = false ]]; then
|
|
local was_error=""
|
|
for qparam in "${query_params[@]}" "${path_params[@]}"; do
|
|
local parameter_values
|
|
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
|
|
|
|
#
|
|
# Check if the number of provided values is not less than minimum required
|
|
#
|
|
if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurrences["${operation}:::${qparam}"]} ]]; then
|
|
echo "ERROR: Too few values provided for '${qparam}' parameter."
|
|
was_error=true
|
|
fi
|
|
|
|
#
|
|
# Check if the number of provided values is not more than maximum
|
|
#
|
|
if [[ ${operation_parameters_maximum_occurrences["${operation}:::${qparam}"]} -gt 0 \
|
|
&& ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurrences["${operation}:::${qparam}"]} ]]; then
|
|
echo "ERROR: Too many values provided for '${qparam}' parameter"
|
|
was_error=true
|
|
fi
|
|
done
|
|
if [[ -n "$was_error" ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# First replace all path parameters in the path
|
|
for pparam in "${path_params[@]}"; do
|
|
local path_regex="(.*)(\\{$pparam\\})(.*)"
|
|
if [[ $path_template =~ $path_regex ]]; then
|
|
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
|
|
fi
|
|
done
|
|
|
|
local query_request_part=""
|
|
|
|
for qparam in "${query_params[@]}"; do
|
|
if [[ "${operation_parameters[$qparam]}" == "" ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Get the array of parameter values
|
|
local parameter_value=""
|
|
local parameter_values
|
|
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
|
|
|
|
|
|
if [[ ${qparam} == "api_key_query" ]]; then
|
|
if [[ -n "${parameter_values[*]}" ]]; then
|
|
parameter_value+="${qparam}=${parameter_values}"
|
|
else
|
|
echo "Missing ApiKey!!! You have to provide on command line option 'api_key_query=...'"
|
|
exit 1
|
|
fi
|
|
continue
|
|
fi
|
|
|
|
#
|
|
# Append parameters without specific cardinality
|
|
#
|
|
local collection_type="${operation_parameters_collection_type["${operation}:::${qparam}"]}"
|
|
if [[ "${collection_type}" == "" ]]; then
|
|
local vcount=0
|
|
for qvalue in "${parameter_values[@]}"; do
|
|
if [[ $((vcount++)) -gt 0 ]]; then
|
|
parameter_value+="&"
|
|
fi
|
|
parameter_value+="${qparam}=${qvalue}"
|
|
done
|
|
#
|
|
# Append parameters specified as 'mutli' collections i.e. param=value1¶m=value2&...
|
|
#
|
|
elif [[ "${collection_type}" == "multi" ]]; then
|
|
local vcount=0
|
|
for qvalue in "${parameter_values[@]}"; do
|
|
if [[ $((vcount++)) -gt 0 ]]; then
|
|
parameter_value+="&"
|
|
fi
|
|
parameter_value+="${qparam}=${qvalue}"
|
|
done
|
|
#
|
|
# Append parameters specified as 'csv' collections i.e. param=value1,value2,...
|
|
#
|
|
elif [[ "${collection_type}" == "csv" ]]; then
|
|
parameter_value+="${qparam}="
|
|
local vcount=0
|
|
for qvalue in "${parameter_values[@]}"; do
|
|
if [[ $((vcount++)) -gt 0 ]]; then
|
|
parameter_value+=","
|
|
fi
|
|
parameter_value+="${qvalue}"
|
|
done
|
|
#
|
|
# Append parameters specified as 'ssv' collections i.e. param="value1 value2 ..."
|
|
#
|
|
elif [[ "${collection_type}" == "ssv" ]]; then
|
|
parameter_value+="${qparam}="
|
|
local vcount=0
|
|
for qvalue in "${parameter_values[@]}"; do
|
|
if [[ $((vcount++)) -gt 0 ]]; then
|
|
parameter_value+=" "
|
|
fi
|
|
parameter_value+="${qvalue}"
|
|
done
|
|
#
|
|
# Append parameters specified as 'tsv' collections i.e. param="value1\tvalue2\t..."
|
|
#
|
|
elif [[ "${collection_type}" == "tsv" ]]; then
|
|
parameter_value+="${qparam}="
|
|
local vcount=0
|
|
for qvalue in "${parameter_values[@]}"; do
|
|
if [[ $((vcount++)) -gt 0 ]]; then
|
|
parameter_value+="\\t"
|
|
fi
|
|
parameter_value+="${qvalue}"
|
|
done
|
|
else
|
|
echo "Unsupported collection format \"${collection_type}\""
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -n "${parameter_value}" ]]; then
|
|
if [[ -n "${query_request_part}" ]]; then
|
|
query_request_part+="&"
|
|
fi
|
|
query_request_part+="${parameter_value}"
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
# Now append query parameters - if any
|
|
if [[ -n "${query_request_part}" ]]; then
|
|
path_template+="?${query_request_part}"
|
|
fi
|
|
|
|
echo "$path_template"
|
|
}
|
|
|
|
|
|
|
|
###############################################################################
|
|
#
|
|
# Print main help message
|
|
#
|
|
###############################################################################
|
|
print_help() {
|
|
cat <<EOF
|
|
|
|
${BOLD}${WHITE}OpenAPI Petstore command line client (API version 1.0.0)${OFF}
|
|
|
|
${BOLD}${WHITE}Usage${OFF}
|
|
|
|
${GREEN}${script_name}${OFF} [-h|--help] [-V|--version] [--about] [${RED}<curl-options>${OFF}]
|
|
[-ac|--accept ${GREEN}<mime-type>${OFF}] [-ct,--content-type ${GREEN}<mime-type>${OFF}]
|
|
[--host ${CYAN}<url>${OFF}] [--dry-run] [-nc|--no-colors] ${YELLOW}<operation>${OFF} [-h|--help]
|
|
[${BLUE}<headers>${OFF}] [${MAGENTA}<parameters>${OFF}] [${MAGENTA}<body-parameters>${OFF}]
|
|
|
|
- ${CYAN}<url>${OFF} - endpoint of the REST service without basepath
|
|
|
|
- ${RED}<curl-options>${OFF} - any valid cURL options can be passed before ${YELLOW}<operation>${OFF}
|
|
- ${GREEN}<mime-type>${OFF} - either full mime-type or one of supported abbreviations:
|
|
(text, html, md, csv, css, rtf, json, xml, yaml, js, bin,
|
|
rdf, jpg, png, gif, bmp, tiff)
|
|
- ${BLUE}<headers>${OFF} - HTTP headers can be passed in the form ${YELLOW}HEADER${OFF}:${BLUE}VALUE${OFF}
|
|
- ${MAGENTA}<parameters>${OFF} - REST operation parameters can be passed in the following
|
|
forms:
|
|
* ${YELLOW}KEY${OFF}=${BLUE}VALUE${OFF} - path or query parameters
|
|
- ${MAGENTA}<body-parameters>${OFF} - simple JSON body content (first level only) can be build
|
|
using the following arguments:
|
|
* ${YELLOW}KEY${OFF}==${BLUE}VALUE${OFF} - body parameters which will be added to body
|
|
JSON as '{ ..., "${YELLOW}KEY${OFF}": "${BLUE}VALUE${OFF}", ... }'
|
|
* ${YELLOW}KEY${OFF}:=${BLUE}VALUE${OFF} - body parameters which will be added to body
|
|
JSON as '{ ..., "${YELLOW}KEY${OFF}": ${BLUE}VALUE${OFF}, ... }'
|
|
|
|
EOF
|
|
echo -e "${BOLD}${WHITE}Authentication methods${OFF}"
|
|
echo -e ""
|
|
echo -e " - ${BLUE}Api-key${OFF} - add '${RED}api_key:<api-key>${OFF}' after ${YELLOW}<operation>${OFF}"
|
|
|
|
echo -e " - ${BLUE}Api-key${OFF} - add '${RED}api_key_query=<api-key>${OFF}' after ${YELLOW}<operation>${OFF}"
|
|
|
|
echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u <username>:<password>' before ${YELLOW}<operation>${OFF}"
|
|
|
|
echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u <username>:<password>' before ${YELLOW}<operation>${OFF}"
|
|
|
|
echo -e " - ${MAGENTA}OAuth2 (flow: implicit)${OFF}"
|
|
echo -e " Authorization URL: "
|
|
echo -e " * http://petstore.swagger.io/api/oauth/dialog"
|
|
echo -e " Scopes:"
|
|
echo -e " * write:pets - modify pets in your account"
|
|
echo -e " * read:pets - read your pets"
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Operations (grouped by tags)${OFF}"
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[anotherFake]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}123Test@$%SpecialTags${OFF};To test special tags
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[default]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}fooGet${OFF};
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[fake]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}fakeHealthGet${OFF};Health check endpoint
|
|
${CYAN}fakeOuterBooleanSerialize${OFF};
|
|
${CYAN}fakeOuterCompositeSerialize${OFF};
|
|
${CYAN}fakeOuterNumberSerialize${OFF};
|
|
${CYAN}fakeOuterStringSerialize${OFF};
|
|
${CYAN}testBodyWithFileSchema${OFF};
|
|
${CYAN}testBodyWithQueryParams${OFF};
|
|
${CYAN}testClientModel${OFF};To test \"client\" model
|
|
${CYAN}testEndpointParameters${OFF};Fake endpoint for testing various parameters
|
|
假端點
|
|
偽のエンドポイント
|
|
가짜 엔드 포인트 (AUTH)
|
|
${CYAN}testEnumParameters${OFF};To test enum parameters
|
|
${CYAN}testGroupParameters${OFF};Fake endpoint to test group parameters (optional) (AUTH)
|
|
${CYAN}testInlineAdditionalProperties${OFF};test inline additionalProperties
|
|
${CYAN}testJsonFormData${OFF};test json serialization of form data
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[fakeClassnameTags123]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}testClassname${OFF};To test class name in snake case (AUTH)
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[pet]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}addPet${OFF};Add a new pet to the store (AUTH)
|
|
${CYAN}deletePet${OFF};Deletes a pet (AUTH)
|
|
${CYAN}findPetsByStatus${OFF};Finds Pets by status (AUTH)
|
|
${CYAN}findPetsByTags${OFF};Finds Pets by tags (AUTH)
|
|
${CYAN}getPetById${OFF};Find pet by ID (AUTH)
|
|
${CYAN}updatePet${OFF};Update an existing pet (AUTH)
|
|
${CYAN}updatePetWithForm${OFF};Updates a pet in the store with form data (AUTH)
|
|
${CYAN}uploadFile${OFF};uploads an image (AUTH)
|
|
${CYAN}uploadFileWithRequiredFile${OFF};uploads an image (required) (AUTH)
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[store]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}deleteOrder${OFF};Delete purchase order by ID
|
|
${CYAN}getInventory${OFF};Returns pet inventories by status (AUTH)
|
|
${CYAN}getOrderById${OFF};Find purchase order by ID
|
|
${CYAN}placeOrder${OFF};Place an order for a pet
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}[user]${OFF}"
|
|
read -r -d '' ops <<EOF
|
|
${CYAN}createUser${OFF};Create user
|
|
${CYAN}createUsersWithArrayInput${OFF};Creates list of users with given input array
|
|
${CYAN}createUsersWithListInput${OFF};Creates list of users with given input array
|
|
${CYAN}deleteUser${OFF};Delete user
|
|
${CYAN}getUserByName${OFF};Get user by user name
|
|
${CYAN}loginUser${OFF};Logs user into the system
|
|
${CYAN}logoutUser${OFF};Logs out current logged in user session
|
|
${CYAN}updateUser${OFF};Updated user
|
|
EOF
|
|
echo " $ops" | column -t -s ';'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Options${OFF}"
|
|
echo -e " -h,--help\\t\\t\\t\\tPrint this help"
|
|
echo -e " -V,--version\\t\\t\\t\\tPrint API version"
|
|
echo -e " --about\\t\\t\\t\\tPrint the information about service"
|
|
echo -e " --host ${CYAN}<url>${OFF}\\t\\t\\t\\tSpecify the host URL "
|
|
echo -e " \\t\\t\\t\\t(e.g. 'https://petstore.swagger.io')"
|
|
|
|
echo -e " --force\\t\\t\\t\\tForce command invocation in spite of missing"
|
|
echo -e " \\t\\t\\t\\trequired parameters or wrong content type"
|
|
echo -e " --dry-run\\t\\t\\t\\tPrint out the cURL command without"
|
|
echo -e " \\t\\t\\t\\texecuting it"
|
|
echo -e " -nc,--no-colors\\t\\t\\tEnforce print without colors, otherwise autodected"
|
|
echo -e " -ac,--accept ${YELLOW}<mime-type>${OFF}\\t\\tSet the 'Accept' header in the request"
|
|
echo -e " -ct,--content-type ${YELLOW}<mime-type>${OFF}\\tSet the 'Content-type' header in "
|
|
echo -e " \\tthe request"
|
|
echo ""
|
|
}
|
|
|
|
|
|
##############################################################################
|
|
#
|
|
# Print REST service description
|
|
#
|
|
##############################################################################
|
|
print_about() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}OpenAPI Petstore command line client (API version 1.0.0)${OFF}"
|
|
echo ""
|
|
echo -e "License: Apache-2.0"
|
|
echo -e "Contact: "
|
|
echo ""
|
|
read -r -d '' appdescription <<EOF
|
|
|
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
EOF
|
|
echo "$appdescription" | paste -sd' ' | fold -sw 80
|
|
}
|
|
|
|
|
|
##############################################################################
|
|
#
|
|
# Print REST api version
|
|
#
|
|
##############################################################################
|
|
print_version() {
|
|
echo ""
|
|
echo -e "${BOLD}OpenAPI Petstore command line client (API version 1.0.0)${OFF}"
|
|
echo ""
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Print help for 123Test@$%SpecialTags operation
|
|
#
|
|
##############################################################################
|
|
print_123Test@$%SpecialTags_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}123Test@$%SpecialTags - To test special tags${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "To test special tags and operation ID starting with number" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - client model" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for fooGet operation
|
|
#
|
|
##############################################################################
|
|
print_fooGet_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}fooGet - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=0
|
|
echo -e "${result_color_table[${code:0:1}]} 0;response${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for fakeHealthGet operation
|
|
#
|
|
##############################################################################
|
|
print_fakeHealthGet_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}fakeHealthGet - Health check endpoint${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;The instance started successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for fakeOuterBooleanSerialize operation
|
|
#
|
|
##############################################################################
|
|
print_fakeOuterBooleanSerialize_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}fakeOuterBooleanSerialize - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Test serialization of outer boolean types" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input boolean as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;Output boolean${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for fakeOuterCompositeSerialize operation
|
|
#
|
|
##############################################################################
|
|
print_fakeOuterCompositeSerialize_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}fakeOuterCompositeSerialize - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Test serialization of object with outer number type" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input composite as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;Output composite${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for fakeOuterNumberSerialize operation
|
|
#
|
|
##############################################################################
|
|
print_fakeOuterNumberSerialize_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}fakeOuterNumberSerialize - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Test serialization of outer number types" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input number as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;Output number${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for fakeOuterStringSerialize operation
|
|
#
|
|
##############################################################################
|
|
print_fakeOuterStringSerialize_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}fakeOuterStringSerialize - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Test serialization of outer string types" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF}${OFF} - Input string as post body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;Output string${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testBodyWithFileSchema operation
|
|
#
|
|
##############################################################################
|
|
print_testBodyWithFileSchema_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testBodyWithFileSchema - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "For this test, the body for this request much reference a schema named 'File'." | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testBodyWithQueryParams operation
|
|
#
|
|
##############################################################################
|
|
print_testBodyWithQueryParams_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testBodyWithQueryParams - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}query${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW} Specify as: query=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;Success${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testClientModel operation
|
|
#
|
|
##############################################################################
|
|
print_testClientModel_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testClientModel - To test \"client\" model${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "To test \"client\" model" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - client model" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testEndpointParameters operation
|
|
#
|
|
##############################################################################
|
|
print_testEndpointParameters_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testEndpointParameters - Fake endpoint for testing various parameters
|
|
假端點
|
|
偽のエンドポイント
|
|
가짜 엔드 포인트${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Fake endpoint for testing various parameters
|
|
假端點
|
|
偽のエンドポイント
|
|
가짜 엔드 포인트" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid username supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;User not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testEnumParameters operation
|
|
#
|
|
##############################################################################
|
|
print_testEnumParameters_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testEnumParameters - To test enum parameters${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "To test enum parameters" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}enum_header_string_array${OFF} ${BLUE}[array[string]]${OFF} ${CYAN}(default: null)${OFF} - Header parameter enum test (string array) ${YELLOW}Specify as: enum_header_string_array:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}enum_header_string${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: -efg)${OFF} - Header parameter enum test (string) ${YELLOW}Specify as: enum_header_string:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}enum_query_string_array${OFF} ${BLUE}[array[string]]${OFF} ${CYAN}(default: null)${OFF} - Query parameter enum test (string array)${YELLOW} Specify as: enum_query_string_array=value1 enum_query_string_array=value2 enum_query_string_array=...${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}enum_query_string${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: -efg)${OFF} - Query parameter enum test (string)${YELLOW} Specify as: enum_query_string=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}enum_query_integer${OFF} ${BLUE}[integer]${OFF} ${CYAN}(default: null)${OFF} - Query parameter enum test (double)${YELLOW} Specify as: enum_query_integer=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}enum_query_double${OFF} ${BLUE}[float]${OFF} ${CYAN}(default: null)${OFF} - Query parameter enum test (double)${YELLOW} Specify as: enum_query_double=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;Not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testGroupParameters operation
|
|
#
|
|
##############################################################################
|
|
print_testGroupParameters_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testGroupParameters - Fake endpoint to test group parameters (optional)${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Fake endpoint to test group parameters (optional)" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}required_string_group${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Required String in group parameters${YELLOW} Specify as: required_string_group=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}required_boolean_group${OFF} ${BLUE}[boolean]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Required Boolean in group parameters ${YELLOW}Specify as: required_boolean_group:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}required_int64_group${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Required Integer in group parameters${YELLOW} Specify as: required_int64_group=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}string_group${OFF} ${BLUE}[integer]${OFF} ${CYAN}(default: null)${OFF} - String in group parameters${YELLOW} Specify as: string_group=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}boolean_group${OFF} ${BLUE}[boolean]${OFF} ${CYAN}(default: null)${OFF} - Boolean in group parameters ${YELLOW}Specify as: boolean_group:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}int64_group${OFF} ${BLUE}[integer]${OFF} ${CYAN}(default: null)${OFF} - Integer in group parameters${YELLOW} Specify as: int64_group=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Someting wrong${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testInlineAdditionalProperties operation
|
|
#
|
|
##############################################################################
|
|
print_testInlineAdditionalProperties_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testInlineAdditionalProperties - test inline additionalProperties${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - request body" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testJsonFormData operation
|
|
#
|
|
##############################################################################
|
|
print_testJsonFormData_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testJsonFormData - test json serialization of form data${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for testClassname operation
|
|
#
|
|
##############################################################################
|
|
print_testClassname_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}testClassname - To test class name in snake case${OFF}${BLUE}(AUTH - QUERY)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "To test class name in snake case" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - client model" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for addPet operation
|
|
#
|
|
##############################################################################
|
|
print_addPet_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}addPet - Add a new pet to the store${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json,application/xml]${OFF} ${RED}(required)${OFF}${OFF} - Pet object that needs to be added to the store" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=405
|
|
echo -e "${result_color_table[${code:0:1}]} 405;Invalid input${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for deletePet operation
|
|
#
|
|
##############################################################################
|
|
print_deletePet_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}deletePet - Deletes a pet${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}petId${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Pet id to delete ${YELLOW}Specify as: petId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}api_key${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW}Specify as: api_key:value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid pet value${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for findPetsByStatus operation
|
|
#
|
|
##############################################################################
|
|
print_findPetsByStatus_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}findPetsByStatus - Finds Pets by status${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Multiple status values can be provided with comma separated strings" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}status${OFF} ${BLUE}[array[string]]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Status values that need to be considered for filter${YELLOW} Specify as: status="value1,value2,..."${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid status value${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for findPetsByTags operation
|
|
#
|
|
##############################################################################
|
|
print_findPetsByTags_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}findPetsByTags - Finds Pets by tags${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}tags${OFF} ${BLUE}[array[string]]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Tags to filter by${YELLOW} Specify as: tags="value1,value2,..."${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid tag value${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for getPetById operation
|
|
#
|
|
##############################################################################
|
|
print_getPetById_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}getPetById - Find pet by ID${OFF}${BLUE}(AUTH - HEADER)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Returns a single pet" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}petId${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of pet to return ${YELLOW}Specify as: petId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid ID supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;Pet not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for updatePet operation
|
|
#
|
|
##############################################################################
|
|
print_updatePet_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}updatePet - Update an existing pet${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json,application/xml]${OFF} ${RED}(required)${OFF}${OFF} - Pet object that needs to be added to the store" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid ID supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;Pet not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=405
|
|
echo -e "${result_color_table[${code:0:1}]} 405;Validation exception${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for updatePetWithForm operation
|
|
#
|
|
##############################################################################
|
|
print_updatePetWithForm_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}updatePetWithForm - Updates a pet in the store with form data${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}petId${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of pet that needs to be updated ${YELLOW}Specify as: petId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=405
|
|
echo -e "${result_color_table[${code:0:1}]} 405;Invalid input${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for uploadFile operation
|
|
#
|
|
##############################################################################
|
|
print_uploadFile_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}uploadFile - uploads an image${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}petId${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of pet to update ${YELLOW}Specify as: petId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for uploadFileWithRequiredFile operation
|
|
#
|
|
##############################################################################
|
|
print_uploadFileWithRequiredFile_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}uploadFileWithRequiredFile - uploads an image (required)${OFF}${BLUE}(AUTH - OAuth2)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}petId${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of pet to update ${YELLOW}Specify as: petId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for deleteOrder operation
|
|
#
|
|
##############################################################################
|
|
print_deleteOrder_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}deleteOrder - Delete purchase order by ID${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}order_id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the order that needs to be deleted ${YELLOW}Specify as: order_id=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid ID supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;Order not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for getInventory operation
|
|
#
|
|
##############################################################################
|
|
print_getInventory_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}getInventory - Returns pet inventories by status${OFF}${BLUE}(AUTH - HEADER)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "Returns a map of status codes to quantities" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for getOrderById operation
|
|
#
|
|
##############################################################################
|
|
print_getOrderById_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}getOrderById - Find purchase order by ID${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}order_id${OFF} ${BLUE}[integer]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of pet that needs to be fetched ${YELLOW}Specify as: order_id=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid ID supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;Order not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for placeOrder operation
|
|
#
|
|
##############################################################################
|
|
print_placeOrder_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}placeOrder - Place an order for a pet${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - order placed for purchasing the pet" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid Order${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for createUser operation
|
|
#
|
|
##############################################################################
|
|
print_createUser_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}createUser - Create user${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "This can only be done by the logged in user." | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - Created user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=0
|
|
echo -e "${result_color_table[${code:0:1}]} 0;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for createUsersWithArrayInput operation
|
|
#
|
|
##############################################################################
|
|
print_createUsersWithArrayInput_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}createUsersWithArrayInput - Creates list of users with given input array${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - List of user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=0
|
|
echo -e "${result_color_table[${code:0:1}]} 0;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for createUsersWithListInput operation
|
|
#
|
|
##############################################################################
|
|
print_createUsersWithListInput_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}createUsersWithListInput - Creates list of users with given input array${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - List of user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=0
|
|
echo -e "${result_color_table[${code:0:1}]} 0;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for deleteUser operation
|
|
#
|
|
##############################################################################
|
|
print_deleteUser_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}deleteUser - Delete user${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "This can only be done by the logged in user." | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}username${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - The name that needs to be deleted ${YELLOW}Specify as: username=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid username supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;User not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for getUserByName operation
|
|
#
|
|
##############################################################################
|
|
print_getUserByName_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}getUserByName - Get user by user name${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}username${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - The name that needs to be fetched. Use user1 for testing. ${YELLOW}Specify as: username=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid username supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;User not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for loginUser operation
|
|
#
|
|
##############################################################################
|
|
print_loginUser_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}loginUser - Logs user into the system${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}username${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - The user name for login${YELLOW} Specify as: username=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}password${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - The password for login in clear text${YELLOW} Specify as: password=value${OFF}" \
|
|
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=200
|
|
echo -e "${result_color_table[${code:0:1}]} 200;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " ${BOLD}${WHITE}Response headers${OFF}"
|
|
echo -e " ${BLUE}X-Rate-Limit${OFF} - calls per hour allowed by the user" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " ${BLUE}X-Expires-After${OFF} - date in UTC when token expires" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid username/password supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for logoutUser operation
|
|
#
|
|
##############################################################################
|
|
print_logoutUser_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}logoutUser - Logs out current logged in user session${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=0
|
|
echo -e "${result_color_table[${code:0:1}]} 0;successful operation${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
##############################################################################
|
|
#
|
|
# Print help for updateUser operation
|
|
#
|
|
##############################################################################
|
|
print_updateUser_help() {
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}updateUser - Updated user${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo -e "This can only be done by the logged in user." | paste -sd' ' | fold -sw 80
|
|
echo -e ""
|
|
echo -e "${BOLD}${WHITE}Parameters${OFF}"
|
|
echo -e " * ${GREEN}username${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - name that need to be deleted ${YELLOW}Specify as: username=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - Updated user object" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
|
|
echo -e ""
|
|
echo ""
|
|
echo -e "${BOLD}${WHITE}Responses${OFF}"
|
|
code=400
|
|
echo -e "${result_color_table[${code:0:1}]} 400;Invalid user supplied${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
code=404
|
|
echo -e "${result_color_table[${code:0:1}]} 404;User not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
|
|
}
|
|
|
|
|
|
##############################################################################
|
|
#
|
|
# Call 123Test@$%SpecialTags operation
|
|
#
|
|
##############################################################################
|
|
call_123Test@$%SpecialTags() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/another-fake/dummy" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PATCH"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call fooGet operation
|
|
#
|
|
##############################################################################
|
|
call_fooGet() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/foo" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call fakeHealthGet operation
|
|
#
|
|
##############################################################################
|
|
call_fakeHealthGet() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/health" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call fakeOuterBooleanSerialize operation
|
|
#
|
|
##############################################################################
|
|
call_fakeOuterBooleanSerialize() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/outer/boolean" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call fakeOuterCompositeSerialize operation
|
|
#
|
|
##############################################################################
|
|
call_fakeOuterCompositeSerialize() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/outer/composite" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call fakeOuterNumberSerialize operation
|
|
#
|
|
##############################################################################
|
|
call_fakeOuterNumberSerialize() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/outer/number" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call fakeOuterStringSerialize operation
|
|
#
|
|
##############################################################################
|
|
call_fakeOuterStringSerialize() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/outer/string" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testBodyWithFileSchema operation
|
|
#
|
|
##############################################################################
|
|
call_testBodyWithFileSchema() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/body-with-file-schema" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PUT"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testBodyWithQueryParams operation
|
|
#
|
|
##############################################################################
|
|
call_testBodyWithQueryParams() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=(query)
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/body-with-query-params" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PUT"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testClientModel operation
|
|
#
|
|
##############################################################################
|
|
call_testClientModel() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PATCH"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testEndpointParameters operation
|
|
#
|
|
##############################################################################
|
|
call_testEndpointParameters() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testEnumParameters operation
|
|
#
|
|
##############################################################################
|
|
call_testEnumParameters() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=(enum_query_string_array enum_query_string enum_query_integer enum_query_double)
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testGroupParameters operation
|
|
#
|
|
##############################################################################
|
|
call_testGroupParameters() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=(required_string_group required_int64_group string_group int64_group )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="DELETE"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testInlineAdditionalProperties operation
|
|
#
|
|
##############################################################################
|
|
call_testInlineAdditionalProperties() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/inline-additionalProperties" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testJsonFormData operation
|
|
#
|
|
##############################################################################
|
|
call_testJsonFormData() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/jsonFormData" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call testClassname operation
|
|
#
|
|
##############################################################################
|
|
call_testClassname() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( api_key_query )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake_classname_test" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PATCH"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call addPet operation
|
|
#
|
|
##############################################################################
|
|
call_addPet() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo -e "\\t- application/xml"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call deletePet operation
|
|
#
|
|
##############################################################################
|
|
call_deletePet() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(petId)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="DELETE"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call findPetsByStatus operation
|
|
#
|
|
##############################################################################
|
|
call_findPetsByStatus() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=(status )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet/findByStatus" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call findPetsByTags operation
|
|
#
|
|
##############################################################################
|
|
call_findPetsByTags() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=(tags )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet/findByTags" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call getPetById operation
|
|
#
|
|
##############################################################################
|
|
call_getPetById() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(petId)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call updatePet operation
|
|
#
|
|
##############################################################################
|
|
call_updatePet() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PUT"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo -e "\\t- application/xml"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call updatePetWithForm operation
|
|
#
|
|
##############################################################################
|
|
call_updatePetWithForm() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(petId)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call uploadFile operation
|
|
#
|
|
##############################################################################
|
|
call_uploadFile() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(petId)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/pet/{petId}/uploadImage" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call uploadFileWithRequiredFile operation
|
|
#
|
|
##############################################################################
|
|
call_uploadFileWithRequiredFile() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(petId)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/fake/{petId}/uploadImageWithRequiredFile" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call deleteOrder operation
|
|
#
|
|
##############################################################################
|
|
call_deleteOrder() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(order_id)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/store/order/{order_id}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="DELETE"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call getInventory operation
|
|
#
|
|
##############################################################################
|
|
call_getInventory() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=( )
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/store/inventory" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call getOrderById operation
|
|
#
|
|
##############################################################################
|
|
call_getOrderById() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(order_id)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/store/order/{order_id}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call placeOrder operation
|
|
#
|
|
##############################################################################
|
|
call_placeOrder() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/store/order" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call createUser operation
|
|
#
|
|
##############################################################################
|
|
call_createUser() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call createUsersWithArrayInput operation
|
|
#
|
|
##############################################################################
|
|
call_createUsersWithArrayInput() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/createWithArray" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call createUsersWithListInput operation
|
|
#
|
|
##############################################################################
|
|
call_createUsersWithListInput() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/createWithList" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="POST"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call deleteUser operation
|
|
#
|
|
##############################################################################
|
|
call_deleteUser() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(username)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="DELETE"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call getUserByName operation
|
|
#
|
|
##############################################################################
|
|
call_getUserByName() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(username)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call loginUser operation
|
|
#
|
|
##############################################################################
|
|
call_loginUser() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=(username password)
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/login" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call logoutUser operation
|
|
#
|
|
##############################################################################
|
|
call_logoutUser() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=()
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/logout" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="GET"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
|
|
fi
|
|
}
|
|
|
|
##############################################################################
|
|
#
|
|
# Call updateUser operation
|
|
#
|
|
##############################################################################
|
|
call_updateUser() {
|
|
# ignore error about 'path_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local path_parameter_names=(username)
|
|
# ignore error about 'query_parameter_names' being unused; passed by reference
|
|
# shellcheck disable=SC2034
|
|
local query_parameter_names=()
|
|
local path
|
|
|
|
if ! path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names); then
|
|
ERROR_MSG=$path
|
|
exit 1
|
|
fi
|
|
local method="PUT"
|
|
local headers_curl
|
|
headers_curl=$(header_arguments_to_curl)
|
|
if [[ -n $header_accept ]]; then
|
|
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
|
|
fi
|
|
|
|
local basic_auth_option=""
|
|
if [[ -n $basic_auth_credential ]]; then
|
|
basic_auth_option="-u ${basic_auth_credential}"
|
|
fi
|
|
local body_json_curl=""
|
|
|
|
#
|
|
# Check if the user provided 'Content-type' headers in the
|
|
# command line. If not try to set them based on the OpenAPI specification
|
|
# if values produces and consumes are defined unambigously
|
|
#
|
|
if [[ -z $header_content_type ]]; then
|
|
header_content_type="application/json"
|
|
fi
|
|
|
|
|
|
if [[ -z $header_content_type && "$force" = false ]]; then
|
|
:
|
|
echo "ERROR: Request's content-type not specified!!!"
|
|
echo "This operation expects content-type in one of the following formats:"
|
|
echo -e "\\t- application/json"
|
|
echo ""
|
|
echo "Use '--content-type' to set proper content type"
|
|
exit 1
|
|
else
|
|
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
|
|
fi
|
|
|
|
|
|
#
|
|
# If we have received some body content over pipe, pass it from the
|
|
# temporary file to cURL
|
|
#
|
|
if [[ -n $body_content_temp_file ]]; then
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
else
|
|
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
|
|
fi
|
|
rm "${body_content_temp_file}"
|
|
#
|
|
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
|
|
#
|
|
else
|
|
body_json_curl=$(body_parameters_to_json)
|
|
if [[ "$print_curl" = true ]]; then
|
|
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
else
|
|
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
|
|
fi
|
|
fi
|
|
}
|
|
|
|
|
|
|
|
##############################################################################
|
|
#
|
|
# Main
|
|
#
|
|
##############################################################################
|
|
|
|
|
|
# Check dependencies
|
|
type curl >/dev/null 2>&1 || { echo >&2 "ERROR: You do not have 'cURL' installed."; exit 1; }
|
|
type sed >/dev/null 2>&1 || { echo >&2 "ERROR: You do not have 'sed' installed."; exit 1; }
|
|
type column >/dev/null 2>&1 || { echo >&2 "ERROR: You do not have 'bsdmainutils' installed."; exit 1; }
|
|
|
|
#
|
|
# Process command line
|
|
#
|
|
# Pass all arguments before 'operation' to cURL except the ones we override
|
|
#
|
|
take_user=false
|
|
take_host=false
|
|
take_accept_header=false
|
|
take_contenttype_header=false
|
|
|
|
for key in "$@"; do
|
|
# Take the value of -u|--user argument
|
|
if [[ "$take_user" = true ]]; then
|
|
basic_auth_credential="$key"
|
|
take_user=false
|
|
continue
|
|
fi
|
|
# Take the value of --host argument
|
|
if [[ "$take_host" = true ]]; then
|
|
host="$key"
|
|
take_host=false
|
|
continue
|
|
fi
|
|
# Take the value of --accept argument
|
|
if [[ "$take_accept_header" = true ]]; then
|
|
header_accept=$(lookup_mime_type "$key")
|
|
take_accept_header=false
|
|
continue
|
|
fi
|
|
# Take the value of --content-type argument
|
|
if [[ "$take_contenttype_header" = true ]]; then
|
|
header_content_type=$(lookup_mime_type "$key")
|
|
take_contenttype_header=false
|
|
continue
|
|
fi
|
|
case $key in
|
|
-h|--help)
|
|
if [[ "x$operation" == "x" ]]; then
|
|
print_help
|
|
exit 0
|
|
else
|
|
eval "print_${operation}_help"
|
|
exit 0
|
|
fi
|
|
;;
|
|
-V|--version)
|
|
print_version
|
|
exit 0
|
|
;;
|
|
--about)
|
|
print_about
|
|
exit 0
|
|
;;
|
|
-u|--user)
|
|
take_user=true
|
|
;;
|
|
--host)
|
|
take_host=true
|
|
;;
|
|
--force)
|
|
force=true
|
|
;;
|
|
-ac|--accept)
|
|
take_accept_header=true
|
|
;;
|
|
-ct|--content-type)
|
|
take_contenttype_header=true
|
|
;;
|
|
--dry-run)
|
|
print_curl=true
|
|
;;
|
|
-nc|--no-colors)
|
|
RED=""
|
|
GREEN=""
|
|
YELLOW=""
|
|
BLUE=""
|
|
MAGENTA=""
|
|
CYAN=""
|
|
WHITE=""
|
|
BOLD=""
|
|
OFF=""
|
|
result_color_table=( "" "" "" "" "" "" "" )
|
|
;;
|
|
123Test@$%SpecialTags)
|
|
operation="123Test@$%SpecialTags"
|
|
;;
|
|
fooGet)
|
|
operation="fooGet"
|
|
;;
|
|
fakeHealthGet)
|
|
operation="fakeHealthGet"
|
|
;;
|
|
fakeOuterBooleanSerialize)
|
|
operation="fakeOuterBooleanSerialize"
|
|
;;
|
|
fakeOuterCompositeSerialize)
|
|
operation="fakeOuterCompositeSerialize"
|
|
;;
|
|
fakeOuterNumberSerialize)
|
|
operation="fakeOuterNumberSerialize"
|
|
;;
|
|
fakeOuterStringSerialize)
|
|
operation="fakeOuterStringSerialize"
|
|
;;
|
|
testBodyWithFileSchema)
|
|
operation="testBodyWithFileSchema"
|
|
;;
|
|
testBodyWithQueryParams)
|
|
operation="testBodyWithQueryParams"
|
|
;;
|
|
testClientModel)
|
|
operation="testClientModel"
|
|
;;
|
|
testEndpointParameters)
|
|
operation="testEndpointParameters"
|
|
;;
|
|
testEnumParameters)
|
|
operation="testEnumParameters"
|
|
;;
|
|
testGroupParameters)
|
|
operation="testGroupParameters"
|
|
;;
|
|
testInlineAdditionalProperties)
|
|
operation="testInlineAdditionalProperties"
|
|
;;
|
|
testJsonFormData)
|
|
operation="testJsonFormData"
|
|
;;
|
|
testClassname)
|
|
operation="testClassname"
|
|
;;
|
|
addPet)
|
|
operation="addPet"
|
|
;;
|
|
deletePet)
|
|
operation="deletePet"
|
|
;;
|
|
findPetsByStatus)
|
|
operation="findPetsByStatus"
|
|
;;
|
|
findPetsByTags)
|
|
operation="findPetsByTags"
|
|
;;
|
|
getPetById)
|
|
operation="getPetById"
|
|
;;
|
|
updatePet)
|
|
operation="updatePet"
|
|
;;
|
|
updatePetWithForm)
|
|
operation="updatePetWithForm"
|
|
;;
|
|
uploadFile)
|
|
operation="uploadFile"
|
|
;;
|
|
uploadFileWithRequiredFile)
|
|
operation="uploadFileWithRequiredFile"
|
|
;;
|
|
deleteOrder)
|
|
operation="deleteOrder"
|
|
;;
|
|
getInventory)
|
|
operation="getInventory"
|
|
;;
|
|
getOrderById)
|
|
operation="getOrderById"
|
|
;;
|
|
placeOrder)
|
|
operation="placeOrder"
|
|
;;
|
|
createUser)
|
|
operation="createUser"
|
|
;;
|
|
createUsersWithArrayInput)
|
|
operation="createUsersWithArrayInput"
|
|
;;
|
|
createUsersWithListInput)
|
|
operation="createUsersWithListInput"
|
|
;;
|
|
deleteUser)
|
|
operation="deleteUser"
|
|
;;
|
|
getUserByName)
|
|
operation="getUserByName"
|
|
;;
|
|
loginUser)
|
|
operation="loginUser"
|
|
;;
|
|
logoutUser)
|
|
operation="logoutUser"
|
|
;;
|
|
updateUser)
|
|
operation="updateUser"
|
|
;;
|
|
*==*)
|
|
# Parse body arguments and convert them into top level
|
|
# JSON properties passed in the body content as strings
|
|
if [[ "$operation" ]]; then
|
|
IFS='==' read -r body_key sep body_value <<< "$key"
|
|
body_parameters[${body_key}]="\"${body_value}\""
|
|
fi
|
|
;;
|
|
*:=*)
|
|
# Parse body arguments and convert them into top level
|
|
# JSON properties passed in the body content without qoutes
|
|
if [[ "$operation" ]]; then
|
|
# ignore error about 'sep' being unused
|
|
# shellcheck disable=SC2034
|
|
IFS=':=' read -r body_key sep body_value <<< "$key"
|
|
body_parameters[${body_key}]=${body_value}
|
|
fi
|
|
;;
|
|
+\([^=]\):*)
|
|
# Parse header arguments and convert them into curl
|
|
# only after the operation argument
|
|
if [[ "$operation" ]]; then
|
|
IFS=':' read -r header_name header_value <<< "$key"
|
|
#
|
|
# If the header key is the same as the api_key expected by API in the
|
|
# header, override the ${apikey_auth_credential} variable
|
|
#
|
|
if [[ $header_name == "api_key" ]]; then
|
|
apikey_auth_credential=$header_value
|
|
fi
|
|
header_arguments[$header_name]=$header_value
|
|
else
|
|
curl_arguments+=" $key"
|
|
fi
|
|
;;
|
|
-)
|
|
body_content_temp_file=$(mktemp)
|
|
cat - > "$body_content_temp_file"
|
|
;;
|
|
*=*)
|
|
# Parse operation arguments and convert them into curl
|
|
# only after the operation argument
|
|
if [[ "$operation" ]]; then
|
|
IFS='=' read -r parameter_name parameter_value <<< "$key"
|
|
if [[ -z "${operation_parameters[$parameter_name]+foo}" ]]; then
|
|
operation_parameters[$parameter_name]=$(url_escape "${parameter_value}")
|
|
else
|
|
operation_parameters[$parameter_name]+=":::"$(url_escape "${parameter_value}")
|
|
fi
|
|
else
|
|
curl_arguments+=" $key"
|
|
fi
|
|
;;
|
|
*)
|
|
# If we are before the operation, treat the arguments as cURL arguments
|
|
if [[ "x$operation" == "x" ]]; then
|
|
# Maintain quotes around cURL arguments if necessary
|
|
space_regexp="[[:space:]]"
|
|
if [[ $key =~ $space_regexp ]]; then
|
|
curl_arguments+=" \"$key\""
|
|
else
|
|
curl_arguments+=" $key"
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
# Check if user provided host name
|
|
if [[ -z "$host" ]]; then
|
|
ERROR_MSG="ERROR: No hostname provided!!! You have to provide on command line option '--host ...'"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if user specified operation ID
|
|
if [[ -z "$operation" ]]; then
|
|
ERROR_MSG="ERROR: No operation specified!!!"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
# Run cURL command based on the operation ID
|
|
case $operation in
|
|
123Test@$%SpecialTags)
|
|
call_123Test@$%SpecialTags
|
|
;;
|
|
fooGet)
|
|
call_fooGet
|
|
;;
|
|
fakeHealthGet)
|
|
call_fakeHealthGet
|
|
;;
|
|
fakeOuterBooleanSerialize)
|
|
call_fakeOuterBooleanSerialize
|
|
;;
|
|
fakeOuterCompositeSerialize)
|
|
call_fakeOuterCompositeSerialize
|
|
;;
|
|
fakeOuterNumberSerialize)
|
|
call_fakeOuterNumberSerialize
|
|
;;
|
|
fakeOuterStringSerialize)
|
|
call_fakeOuterStringSerialize
|
|
;;
|
|
testBodyWithFileSchema)
|
|
call_testBodyWithFileSchema
|
|
;;
|
|
testBodyWithQueryParams)
|
|
call_testBodyWithQueryParams
|
|
;;
|
|
testClientModel)
|
|
call_testClientModel
|
|
;;
|
|
testEndpointParameters)
|
|
call_testEndpointParameters
|
|
;;
|
|
testEnumParameters)
|
|
call_testEnumParameters
|
|
;;
|
|
testGroupParameters)
|
|
call_testGroupParameters
|
|
;;
|
|
testInlineAdditionalProperties)
|
|
call_testInlineAdditionalProperties
|
|
;;
|
|
testJsonFormData)
|
|
call_testJsonFormData
|
|
;;
|
|
testClassname)
|
|
call_testClassname
|
|
;;
|
|
addPet)
|
|
call_addPet
|
|
;;
|
|
deletePet)
|
|
call_deletePet
|
|
;;
|
|
findPetsByStatus)
|
|
call_findPetsByStatus
|
|
;;
|
|
findPetsByTags)
|
|
call_findPetsByTags
|
|
;;
|
|
getPetById)
|
|
call_getPetById
|
|
;;
|
|
updatePet)
|
|
call_updatePet
|
|
;;
|
|
updatePetWithForm)
|
|
call_updatePetWithForm
|
|
;;
|
|
uploadFile)
|
|
call_uploadFile
|
|
;;
|
|
uploadFileWithRequiredFile)
|
|
call_uploadFileWithRequiredFile
|
|
;;
|
|
deleteOrder)
|
|
call_deleteOrder
|
|
;;
|
|
getInventory)
|
|
call_getInventory
|
|
;;
|
|
getOrderById)
|
|
call_getOrderById
|
|
;;
|
|
placeOrder)
|
|
call_placeOrder
|
|
;;
|
|
createUser)
|
|
call_createUser
|
|
;;
|
|
createUsersWithArrayInput)
|
|
call_createUsersWithArrayInput
|
|
;;
|
|
createUsersWithListInput)
|
|
call_createUsersWithListInput
|
|
;;
|
|
deleteUser)
|
|
call_deleteUser
|
|
;;
|
|
getUserByName)
|
|
call_getUserByName
|
|
;;
|
|
loginUser)
|
|
call_loginUser
|
|
;;
|
|
logoutUser)
|
|
call_logoutUser
|
|
;;
|
|
updateUser)
|
|
call_updateUser
|
|
;;
|
|
*)
|
|
ERROR_MSG="ERROR: Unknown operation: $operation"
|
|
exit 1
|
|
esac
|