Update C++ Restbed server samples with OAS2, OAS3 (#165)

* restore restbed samples from codegen2x

* update restbed samples with oas2

* update restbed sample with oas3 (no diff)
This commit is contained in:
William Cheng
2018-04-20 19:07:42 +08:00
committed by GitHub
parent fa346ce004
commit 8a4f905892
3 changed files with 34 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
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 -l cpp-restbed-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/server/petstore/restbed"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -344,9 +344,9 @@ void UserApiUserLoginResource::GET_method_handler(const std::shared_ptr<restbed:
*/
if (status_code == 200) {
// Description:
// Description: calls per hour allowed by the user
session->set_header("X-Rate-Limit", ""); // Change second param to your header value
// Description:
// Description: date in UTC when toekn expires
session->set_header("X-Expires-After", ""); // Change second param to your header value
session->close(200, "successful operation", { {"Connection", "close"} });
return;

View File

@@ -27,6 +27,7 @@
#include "User.h"
#include <string>
#include <vector>
namespace io {
namespace swagger {