update tizen samples with oas3 petstore (#114)

This commit is contained in:
William Cheng 2018-04-17 22:53:09 +08:00 committed by GitHub
parent 4845eaa81d
commit dc0cbd23b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 15 deletions

31
bin/openapi3/tizen-petstore.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/openapi-generator/src/main/resources/tizen -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l cpp-tizen -o samples/client/petstore/tizen"
java $JAVA_OPTS -jar $executable $ags

View File

@ -95,7 +95,6 @@ static bool addPetHelper(char * accessToken,
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: application/json");
headerList = curl_slist_append(headerList, "Content-Type: application/xml");
map <string, string> queryParams;
string itemAtq;
@ -387,10 +386,12 @@ static bool findPetsByStatusHelper(char * accessToken,
map <string, string> queryParams;
string itemAtq;
itemAtq = stringify(&status, "std::list");
queryParams.insert(pair<string, string>("status", itemAtq));
for (std::list
<std::string>::iterator queryIter = status.begin(); queryIter != status.end(); ++queryIter) {
string itemAt = stringify(&(*queryIter), "std::string");
queryParams.insert(pair<string, string>("status", itemAt));
}
string mBody = "";
JsonNode* node;
JsonArray* json_array;
@ -529,10 +530,12 @@ static bool findPetsByTagsHelper(char * accessToken,
map <string, string> queryParams;
string itemAtq;
itemAtq = stringify(&tags, "std::list");
queryParams.insert(pair<string, string>("tags", itemAtq));
for (std::list
<std::string>::iterator queryIter = tags.begin(); queryIter != tags.end(); ++queryIter) {
string itemAt = stringify(&(*queryIter), "std::string");
queryParams.insert(pair<string, string>("tags", itemAt));
}
string mBody = "";
JsonNode* node;
JsonArray* json_array;
@ -805,7 +808,6 @@ static bool updatePetHelper(char * accessToken,
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: application/json");
headerList = curl_slist_append(headerList, "Content-Type: application/xml");
map <string, string> queryParams;
string itemAtq;

View File

@ -522,7 +522,7 @@ static bool placeOrderHelper(char * accessToken,
string accessHeader = "Authorization: Bearer ";
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: */*");
headerList = curl_slist_append(headerList, "Content-Type: application/json");
map <string, string> queryParams;
string itemAtq;

View File

@ -94,7 +94,7 @@ static bool createUserHelper(char * accessToken,
string accessHeader = "Authorization: Bearer ";
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: */*");
headerList = curl_slist_append(headerList, "Content-Type: application/json");
map <string, string> queryParams;
string itemAtq;
@ -231,7 +231,7 @@ static bool createUsersWithArrayInputHelper(char * accessToken,
string accessHeader = "Authorization: Bearer ";
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: */*");
headerList = curl_slist_append(headerList, "Content-Type: application/json");
map <string, string> queryParams;
string itemAtq;
@ -380,7 +380,7 @@ static bool createUsersWithListInputHelper(char * accessToken,
string accessHeader = "Authorization: Bearer ";
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: */*");
headerList = curl_slist_append(headerList, "Content-Type: application/json");
map <string, string> queryParams;
string itemAtq;
@ -1084,7 +1084,7 @@ static bool updateUserHelper(char * accessToken,
string accessHeader = "Authorization: Bearer ";
accessHeader.append(accessToken);
headerList = curl_slist_append(headerList, accessHeader.c_str());
headerList = curl_slist_append(headerList, "Content-Type: */*");
headerList = curl_slist_append(headerList, "Content-Type: application/json");
map <string, string> queryParams;
string itemAtq;