diff --git a/bin/openapi3/scalaz-petstore.sh b/bin/openapi3/scalaz-petstore.sh new file mode 100755 index 00000000000..7ea1afd0a62 --- /dev/null +++ b/bin/openapi3/scalaz-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/scalaz -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l scalaz -o samples/client/petstore/scalaz" + +java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/scalaz/.swagger-codegen/VERSION b/samples/client/petstore/scalaz/.swagger-codegen/VERSION index f9f7450d135..096bf47efe3 100644 --- a/samples/client/petstore/scalaz/.swagger-codegen/VERSION +++ b/samples/client/petstore/scalaz/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/ApiResponse.scala b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/ApiResponse.scala index 7d4bd29011b..5e167636d3c 100644 --- a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/ApiResponse.scala +++ b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/ApiResponse.scala @@ -11,7 +11,7 @@ import ApiResponse._ case class ApiResponse ( code: Option[Integer], -_type: Option[String], +`type`: Option[String], message: Option[String]) object ApiResponse { diff --git a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/PetApi.scala index 34508d07f84..cbdfc95b3fd 100644 --- a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/PetApi.scala @@ -27,7 +27,7 @@ object PetApi { def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def addPet(host: String, body: Pet): Task[Unit] = { + def addPet(host: String, pet: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.POST @@ -40,7 +40,7 @@ object PetApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(pet) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -128,7 +128,7 @@ object PetApi { } yield resp } - def updatePet(host: String, body: Pet): Task[Unit] = { + def updatePet(host: String, pet: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.PUT @@ -141,7 +141,7 @@ object PetApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(pet) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -194,7 +194,7 @@ class HttpServicePetApi(service: HttpService) { def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def addPet(body: Pet): Task[Unit] = { + def addPet(pet: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.POST @@ -207,7 +207,7 @@ class HttpServicePetApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(pet) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -295,7 +295,7 @@ class HttpServicePetApi(service: HttpService) { } yield resp } - def updatePet(body: Pet): Task[Unit] = { + def updatePet(pet: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.PUT @@ -308,7 +308,7 @@ class HttpServicePetApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(pet) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp diff --git a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/StoreApi.scala b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/StoreApi.scala index 4136582c685..29b5ec736e5 100644 --- a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/StoreApi.scala +++ b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/StoreApi.scala @@ -88,7 +88,7 @@ object StoreApi { } yield resp } - def placeOrder(host: String, body: Order): Task[Order] = { + def placeOrder(host: String, order: Order): Task[Order] = { implicit val returnTypeDecoder: EntityDecoder[Order] = jsonOf[Order] val path = "/store/order" @@ -103,7 +103,7 @@ object StoreApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(order) resp <- client.expect[Order](req) } yield resp @@ -177,7 +177,7 @@ class HttpServiceStoreApi(service: HttpService) { } yield resp } - def placeOrder(body: Order): Task[Order] = { + def placeOrder(order: Order): Task[Order] = { implicit val returnTypeDecoder: EntityDecoder[Order] = jsonOf[Order] val path = "/store/order" @@ -192,7 +192,7 @@ class HttpServiceStoreApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(order) resp <- client.expect[Order](req) } yield resp diff --git a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/UserApi.scala b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/UserApi.scala index ea4619e01f5..fbd5447f389 100644 --- a/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/UserApi.scala +++ b/samples/client/petstore/scalaz/src/main/scala/io/swagger/client/api/UserApi.scala @@ -27,7 +27,7 @@ object UserApi { def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def createUser(host: String, body: User): Task[Unit] = { + def createUser(host: String, user: User): Task[Unit] = { val path = "/user" val httpMethod = Method.POST @@ -40,13 +40,13 @@ object UserApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithArrayInput(host: String, body: List[User]): Task[Unit] = { + def createUsersWithArrayInput(host: String, user: List[User]): Task[Unit] = { val path = "/user/createWithArray" val httpMethod = Method.POST @@ -59,13 +59,13 @@ object UserApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithListInput(host: String, body: List[User]): Task[Unit] = { + def createUsersWithListInput(host: String, user: List[User]): Task[Unit] = { val path = "/user/createWithList" val httpMethod = Method.POST @@ -78,7 +78,7 @@ object UserApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -164,7 +164,7 @@ object UserApi { } yield resp } - def updateUser(host: String, username: String, body: User): Task[Unit] = { + def updateUser(host: String, username: String, user: User): Task[Unit] = { val path = "/user/{username}".replaceAll("\\{" + "username" + "\\}",escape(username.toString)) val httpMethod = Method.PUT @@ -177,7 +177,7 @@ object UserApi { for { uri <- Task.fromDisjunction(Uri.fromString(host + path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -190,7 +190,7 @@ class HttpServiceUserApi(service: HttpService) { def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def createUser(body: User): Task[Unit] = { + def createUser(user: User): Task[Unit] = { val path = "/user" val httpMethod = Method.POST @@ -203,13 +203,13 @@ class HttpServiceUserApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithArrayInput(body: List[User]): Task[Unit] = { + def createUsersWithArrayInput(user: List[User]): Task[Unit] = { val path = "/user/createWithArray" val httpMethod = Method.POST @@ -222,13 +222,13 @@ class HttpServiceUserApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithListInput(body: List[User]): Task[Unit] = { + def createUsersWithListInput(user: List[User]): Task[Unit] = { val path = "/user/createWithList" val httpMethod = Method.POST @@ -241,7 +241,7 @@ class HttpServiceUserApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -327,7 +327,7 @@ class HttpServiceUserApi(service: HttpService) { } yield resp } - def updateUser(username: String, body: User): Task[Unit] = { + def updateUser(username: String, user: User): Task[Unit] = { val path = "/user/{username}".replaceAll("\\{" + "username" + "\\}",escape(username.toString)) val httpMethod = Method.PUT @@ -340,7 +340,7 @@ class HttpServiceUserApi(service: HttpService) { for { uri <- Task.fromDisjunction(Uri.fromString(path)) uriWithParams = uri.copy(query = queryParams) - req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(user) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp