diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 8a0402109f4..999209657da 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1086,6 +1086,7 @@ public class DefaultCodegen implements CodegenConfig { reservedWords = new HashSet(); + // TODO: Move Java specific import mappings out of DefaultCodegen. importMapping = new HashMap(); importMapping.put("BigDecimal", "java.math.BigDecimal"); importMapping.put("UUID", "java.util.UUID"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java index 81d413b2169..ec9cd9f2bf2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java @@ -19,8 +19,11 @@ package org.openapitools.codegen.languages; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,6 +66,8 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen additionalProperties.put("apiPackage", apiPackage); + // Explicitly defining bulid.properties helps guarantee our sample remains compilable against the embedded target 2.11 scala + supportingFiles.add(new SupportingFile("build.properties.mustache", "", "project/build.properties")); supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); supportingFiles.add(new SupportingFile("dateTimeCodecs.mustache", (sourceFolder + File.separator + apiPackage).replace(".", File.separator), "DateTimeCodecs.scala")); supportingFiles.add(new SupportingFile("HelperCodecs.mustache", (sourceFolder + File.separator + apiPackage).replace(".", File.separator), "HelperCodecs.scala")); @@ -71,10 +76,16 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen importMapping.remove("List"); importMapping.remove("Set"); importMapping.remove("Map"); - - importMapping.put("Date", "java.util.Date"); + importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer"); + // Overrides defaults applied in DefaultCodegen which don't apply cleanly to Scala. + importMapping.put("Date", "java.util.Date"); + importMapping.put("DateTime", "org.joda.time.DateTime"); + importMapping.put("LocalDateTime", "org.joda.time.LocalDateTime"); + importMapping.put("LocalDate", "org.joda.time.LocalDate"); + importMapping.put("LocalTime", "org.joda.time.LocalTime"); + typeMapping = new HashMap(); typeMapping.put("enum", "NSString"); typeMapping.put("array", "List"); @@ -179,6 +190,42 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen } + @Override + public String toDefaultValue(Schema p) { + if (p.getDefault() != null) { + return p.getDefault().toString(); + } + + // comment out the following as the default value is no handled differently + if (ModelUtils.isBooleanSchema(p)) { + return null; + } else if (ModelUtils.isDateSchema(p)) { + return null; + } else if (ModelUtils.isDateTimeSchema(p)) { + return null; + } else if (ModelUtils.isNumberSchema(p)) { + return null; + } else if (ModelUtils.isIntegerSchema(p)) { + return null; + } else if (ModelUtils.isMapSchema(p)) { + String inner = getSchemaType(ModelUtils.getAdditionalProperties(p)); + + return "Map.empty[String, " + inner + "] "; + } else if (ModelUtils.isArraySchema(p)) { + ArraySchema ap = (ArraySchema) p; + String inner = getSchemaType(ap.getItems()); + String collectionType = typeMapping.get("array"); + + // We assume that users would map these collections to a monoid with an identity function + // There's no reason to assume mutable structure here (which may make consumption more difficult) + return collectionType + ".empty[" + inner + "] "; + } else if (ModelUtils.isStringSchema(p)) { + return null; + } else { + return null; + } + } + @Override public CodegenType getTag() { return CodegenType.CLIENT; diff --git a/modules/openapi-generator/src/main/resources/scalaz/api.mustache b/modules/openapi-generator/src/main/resources/scalaz/api.mustache index 9eeba0a96ee..cddc6eb008f 100644 --- a/modules/openapi-generator/src/main/resources/scalaz/api.mustache +++ b/modules/openapi-generator/src/main/resources/scalaz/api.mustache @@ -21,6 +21,9 @@ import scalaz.concurrent.Task import HelperCodecs._ +{{#imports}}import {{import}} +{{/imports}} + {{#operations}} object {{classname}} { diff --git a/modules/openapi-generator/src/main/resources/scalaz/build.properties.mustache b/modules/openapi-generator/src/main/resources/scalaz/build.properties.mustache new file mode 100644 index 00000000000..cf19fd026fd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/scalaz/build.properties.mustache @@ -0,0 +1 @@ +sbt.version=0.13.15 \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/scalaz/model.mustache b/modules/openapi-generator/src/main/resources/scalaz/model.mustache index 9333e6bd569..d582ab10abc 100644 --- a/modules/openapi-generator/src/main/resources/scalaz/model.mustache +++ b/modules/openapi-generator/src/main/resources/scalaz/model.mustache @@ -7,6 +7,10 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + +{{#imports}}import {{import}} +{{/imports}} + {{#models}} {{#model}} import {{classname}}._ diff --git a/samples/client/petstore/scalaz/.openapi-generator/VERSION b/samples/client/petstore/scalaz/.openapi-generator/VERSION index 096bf47efe3..e4955748d3e 100644 --- a/samples/client/petstore/scalaz/.openapi-generator/VERSION +++ b/samples/client/petstore/scalaz/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +4.2.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/scalaz/project/build.properties b/samples/client/petstore/scalaz/project/build.properties new file mode 100644 index 00000000000..cf19fd026fd --- /dev/null +++ b/samples/client/petstore/scalaz/project/build.properties @@ -0,0 +1 @@ +sbt.version=0.13.15 \ No newline at end of file diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/ApiResponse.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/ApiResponse.scala index 62497849b41..457b5fd3fd9 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/ApiResponse.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/ApiResponse.scala @@ -7,6 +7,8 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + + import ApiResponse._ case class ApiResponse ( diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Category.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Category.scala index cbc45f6e3f1..a3323b05c59 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Category.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Category.scala @@ -7,6 +7,8 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + + import Category._ case class Category ( diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Order.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Order.scala index d228f817bd4..67e3cd4318a 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Order.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Order.scala @@ -7,6 +7,9 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + +import org.joda.time.DateTime + import Order._ case class Order ( diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Pet.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Pet.scala index 9b75836b88a..933df79c621 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Pet.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Pet.scala @@ -7,6 +7,8 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + + import Pet._ case class Pet ( diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/PetApi.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/PetApi.scala index bafe205709c..79636d5560a 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/PetApi.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/PetApi.scala @@ -21,13 +21,17 @@ import scalaz.concurrent.Task import HelperCodecs._ +import org.openapitools.client.api.ApiResponse +import java.io.File +import org.openapitools.client.api.Pet + object PetApi { val client = PooledHttp1Client() def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def addPet(host: String, pet: Pet): Task[Unit] = { + def addPet(host: String, body: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.POST @@ -40,7 +44,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(pet) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -65,7 +69,7 @@ object PetApi { } yield resp } - def findPetsByStatus(host: String, status: List[String])(implicit statusQuery: QueryParam[List[String]]): Task[List[Pet]] = { + def findPetsByStatus(host: String, status: List[String] = List.empty[String] )(implicit statusQuery: QueryParam[List[String]]): Task[List[Pet]] = { implicit val returnTypeDecoder: EntityDecoder[List[Pet]] = jsonOf[List[Pet]] val path = "/pet/findByStatus" @@ -86,7 +90,7 @@ object PetApi { } yield resp } - def findPetsByTags(host: String, tags: List[String])(implicit tagsQuery: QueryParam[List[String]]): Task[List[Pet]] = { + def findPetsByTags(host: String, tags: List[String] = List.empty[String] )(implicit tagsQuery: QueryParam[List[String]]): Task[List[Pet]] = { implicit val returnTypeDecoder: EntityDecoder[List[Pet]] = jsonOf[List[Pet]] val path = "/pet/findByTags" @@ -128,7 +132,7 @@ object PetApi { } yield resp } - def updatePet(host: String, pet: Pet): Task[Unit] = { + def updatePet(host: String, body: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.PUT @@ -141,7 +145,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(pet) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -194,7 +198,7 @@ class HttpServicePetApi(service: HttpService) { def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def addPet(pet: Pet): Task[Unit] = { + def addPet(body: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.POST @@ -207,7 +211,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(pet) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -232,7 +236,7 @@ class HttpServicePetApi(service: HttpService) { } yield resp } - def findPetsByStatus(status: List[String])(implicit statusQuery: QueryParam[List[String]]): Task[List[Pet]] = { + def findPetsByStatus(status: List[String] = List.empty[String] )(implicit statusQuery: QueryParam[List[String]]): Task[List[Pet]] = { implicit val returnTypeDecoder: EntityDecoder[List[Pet]] = jsonOf[List[Pet]] val path = "/pet/findByStatus" @@ -253,7 +257,7 @@ class HttpServicePetApi(service: HttpService) { } yield resp } - def findPetsByTags(tags: List[String])(implicit tagsQuery: QueryParam[List[String]]): Task[List[Pet]] = { + def findPetsByTags(tags: List[String] = List.empty[String] )(implicit tagsQuery: QueryParam[List[String]]): Task[List[Pet]] = { implicit val returnTypeDecoder: EntityDecoder[List[Pet]] = jsonOf[List[Pet]] val path = "/pet/findByTags" @@ -295,7 +299,7 @@ class HttpServicePetApi(service: HttpService) { } yield resp } - def updatePet(pet: Pet): Task[Unit] = { + def updatePet(body: Pet): Task[Unit] = { val path = "/pet" val httpMethod = Method.PUT @@ -308,7 +312,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(pet) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/StoreApi.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/StoreApi.scala index 30548fac93d..ccb0607174a 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/StoreApi.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/StoreApi.scala @@ -21,6 +21,8 @@ import scalaz.concurrent.Task import HelperCodecs._ +import org.openapitools.client.api.Order + object StoreApi { val client = PooledHttp1Client() @@ -88,7 +90,7 @@ object StoreApi { } yield resp } - def placeOrder(host: String, order: Order): Task[Order] = { + def placeOrder(host: String, body: Order): Task[Order] = { implicit val returnTypeDecoder: EntityDecoder[Order] = jsonOf[Order] val path = "/store/order" @@ -103,7 +105,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(order) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.expect[Order](req) } yield resp @@ -177,7 +179,7 @@ class HttpServiceStoreApi(service: HttpService) { } yield resp } - def placeOrder(order: Order): Task[Order] = { + def placeOrder(body: Order): Task[Order] = { implicit val returnTypeDecoder: EntityDecoder[Order] = jsonOf[Order] val path = "/store/order" @@ -192,7 +194,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(order) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.expect[Order](req) } yield resp diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Tag.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Tag.scala index 96f7807e0a6..2c1e248ba2b 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Tag.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/Tag.scala @@ -7,6 +7,8 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + + import Tag._ case class Tag ( diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/User.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/User.scala index 99a6ca61b51..bf1d2054079 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/User.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/User.scala @@ -7,6 +7,8 @@ import argonaut.DecodeJson._ import org.http4s.{EntityDecoder, EntityEncoder} import org.http4s.argonaut._ import org.joda.time.DateTime + + import User._ case class User ( diff --git a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/UserApi.scala b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/UserApi.scala index 4699158f917..ff45c31941f 100644 --- a/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/UserApi.scala +++ b/samples/client/petstore/scalaz/src/main/scala/org/openapitools/client/api/UserApi.scala @@ -21,13 +21,15 @@ import scalaz.concurrent.Task import HelperCodecs._ +import org.openapitools.client.api.User + object UserApi { val client = PooledHttp1Client() def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def createUser(host: String, user: User): Task[Unit] = { + def createUser(host: String, body: User): Task[Unit] = { val path = "/user" val httpMethod = Method.POST @@ -40,13 +42,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithArrayInput(host: String, user: List[User]): Task[Unit] = { + def createUsersWithArrayInput(host: String, body: List[User]): Task[Unit] = { val path = "/user/createWithArray" val httpMethod = Method.POST @@ -59,13 +61,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithListInput(host: String, user: List[User]): Task[Unit] = { + def createUsersWithListInput(host: String, body: List[User]): Task[Unit] = { val path = "/user/createWithList" val httpMethod = Method.POST @@ -78,7 +80,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -164,7 +166,7 @@ object UserApi { } yield resp } - def updateUser(host: String, username: String, user: User): Task[Unit] = { + def updateUser(host: String, username: String, body: User): Task[Unit] = { val path = "/user/{username}".replaceAll("\\{" + "username" + "\\}",escape(username.toString)) val httpMethod = Method.PUT @@ -177,7 +179,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -190,7 +192,7 @@ class HttpServiceUserApi(service: HttpService) { def escape(value: String): String = URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20") - def createUser(user: User): Task[Unit] = { + def createUser(body: User): Task[Unit] = { val path = "/user" val httpMethod = Method.POST @@ -203,13 +205,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithArrayInput(user: List[User]): Task[Unit] = { + def createUsersWithArrayInput(body: List[User]): Task[Unit] = { val path = "/user/createWithArray" val httpMethod = Method.POST @@ -222,13 +224,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp } - def createUsersWithListInput(user: List[User]): Task[Unit] = { + def createUsersWithListInput(body: List[User]): Task[Unit] = { val path = "/user/createWithList" val httpMethod = Method.POST @@ -241,7 +243,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp @@ -327,7 +329,7 @@ class HttpServiceUserApi(service: HttpService) { } yield resp } - def updateUser(username: String, user: User): Task[Unit] = { + def updateUser(username: String, body: User): Task[Unit] = { val path = "/user/{username}".replaceAll("\\{" + "username" + "\\}",escape(username.toString)) val httpMethod = Method.PUT @@ -340,7 +342,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(user) + req = Request(method = httpMethod, uri = uriWithParams, headers = headers.put(contentType)).withBody(body) resp <- client.fetch[Unit](req)(_ => Task.now(())) } yield resp