Update finch Petstore OAS2 (#126)

* Update finch sample

* Udpate 'finch' samples

* update finch with oas3 petstore (no diff)
This commit is contained in:
Jérémie Bresson 2018-04-20 15:52:22 +02:00 committed by William Cheng
parent 8a4f905892
commit d21e4227a6
3 changed files with 37 additions and 6 deletions

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/finch -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l finch -o samples/server/petstore/finch"
java $JAVA_OPTS -jar $executable $ags

View File

@ -94,13 +94,13 @@ trait DataAccessor {
*
* @return A Unit
*/
def User_createUsersWithArrayInput(seq: Seq[User]): Either[CommonError,Unit] = ???
def User_createUsersWithArrayInput(user: Seq[User]): Either[CommonError,Unit] = ???
/**
*
* @return A Unit
*/
def User_createUsersWithListInput(seq: Seq[User]): Either[CommonError,Unit] = ???
def User_createUsersWithListInput(user: Seq[User]): Either[CommonError,Unit] = ???
/**
*

View File

@ -73,8 +73,8 @@ object UserApi {
* @return An endpoint representing a Unit
*/
private def createUsersWithArrayInput(da: DataAccessor): Endpoint[Unit] =
post("user" :: "createWithArray" :: jsonBody[Seq[User]]) { (seq: Seq[User]) =>
da.User_createUsersWithArrayInput(seq) match {
post("user" :: "createWithArray" :: jsonBody[Seq[User]]) { (user: Seq[User]) =>
da.User_createUsersWithArrayInput(user) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}
@ -87,8 +87,8 @@ object UserApi {
* @return An endpoint representing a Unit
*/
private def createUsersWithListInput(da: DataAccessor): Endpoint[Unit] =
post("user" :: "createWithList" :: jsonBody[Seq[User]]) { (seq: Seq[User]) =>
da.User_createUsersWithListInput(seq) match {
post("user" :: "createWithList" :: jsonBody[Seq[User]]) { (user: Seq[User]) =>
da.User_createUsersWithListInput(user) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}