diff --git a/bin/openapi3/tizen-petstore.sh b/bin/openapi3/tizen-petstore.sh new file mode 100755 index 00000000000..a865055007a --- /dev/null +++ b/bin/openapi3/tizen-petstore.sh @@ -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 diff --git a/samples/client/petstore/tizen/src/PetManager.cpp b/samples/client/petstore/tizen/src/PetManager.cpp index 32357704d6e..59302ee0a35 100644 --- a/samples/client/petstore/tizen/src/PetManager.cpp +++ b/samples/client/petstore/tizen/src/PetManager.cpp @@ -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 queryParams; string itemAtq; @@ -387,10 +386,12 @@ static bool findPetsByStatusHelper(char * accessToken, map queryParams; string itemAtq; - - itemAtq = stringify(&status, "std::list"); - queryParams.insert(pair("status", itemAtq)); - + for (std::list + ::iterator queryIter = status.begin(); queryIter != status.end(); ++queryIter) { + string itemAt = stringify(&(*queryIter), "std::string"); + queryParams.insert(pair("status", itemAt)); + } + string mBody = ""; JsonNode* node; JsonArray* json_array; @@ -529,10 +530,12 @@ static bool findPetsByTagsHelper(char * accessToken, map queryParams; string itemAtq; - - itemAtq = stringify(&tags, "std::list"); - queryParams.insert(pair("tags", itemAtq)); - + for (std::list + ::iterator queryIter = tags.begin(); queryIter != tags.end(); ++queryIter) { + string itemAt = stringify(&(*queryIter), "std::string"); + queryParams.insert(pair("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 queryParams; string itemAtq; diff --git a/samples/client/petstore/tizen/src/StoreManager.cpp b/samples/client/petstore/tizen/src/StoreManager.cpp index 475d4357f90..91958248d70 100644 --- a/samples/client/petstore/tizen/src/StoreManager.cpp +++ b/samples/client/petstore/tizen/src/StoreManager.cpp @@ -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 queryParams; string itemAtq; diff --git a/samples/client/petstore/tizen/src/UserManager.cpp b/samples/client/petstore/tizen/src/UserManager.cpp index d2b657211fb..5dc79b3810f 100644 --- a/samples/client/petstore/tizen/src/UserManager.cpp +++ b/samples/client/petstore/tizen/src/UserManager.cpp @@ -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 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 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 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 queryParams; string itemAtq;