diff --git a/modules/swagger-codegen/src/main/resources/akka-scala/model.mustache b/modules/swagger-codegen/src/main/resources/akka-scala/model.mustache index 0c08f91af7..7743c15718 100644 --- a/modules/swagger-codegen/src/main/resources/akka-scala/model.mustache +++ b/modules/swagger-codegen/src/main/resources/akka-scala/model.mustache @@ -11,24 +11,33 @@ import org.joda.time.DateTime {{#models}} {{#model}} - case class {{classname}} ( - {{#vars}}{{#description}}/* {{{description}}} */ - {{/description}}{{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{datatype}}{{/isEnum}}{{#isEnum}}{{classname}}Enums.{{datatypeWithEnum}}{{/isEnum}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{^hasMore}}){{/hasMore}} - {{/vars}} extends ApiModel + {{#vars}} + {{#description}} + /* {{{description}}} */ + {{/description}} + {{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{datatype}}{{/isEnum}}{{#isEnum}}{{classname}}Enums.{{datatypeWithEnum}}{{/isEnum}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}} + {{/vars}} +) extends ApiModel {{#hasEnums}} object {{classname}}Enums { - {{#vars}}{{#isEnum}}type {{datatypeWithEnum}} = {{datatypeWithEnum}}.Value - {{/isEnum}}{{/vars}} - {{#vars}}{{#isEnum}}object {{datatypeWithEnum}} extends Enumeration { + {{#vars}} + {{#isEnum}} + type {{datatypeWithEnum}} = {{datatypeWithEnum}}.Value + {{/isEnum}} + {{/vars}} + {{#vars}} + {{#isEnum}} + object {{datatypeWithEnum}} extends Enumeration { {{#_enum}} val {{#fnEnumEntry}}{{.}}{{/fnEnumEntry}} = Value("{{.}}") {{/_enum}} } - {{/isEnum}}{{/vars}} + {{/isEnum}} + {{/vars}} } {{/hasEnums}} {{/model}} diff --git a/modules/swagger-codegen/src/main/resources/scala/model.mustache b/modules/swagger-codegen/src/main/resources/scala/model.mustache index 40a9da8dc9..b6920ae9fd 100644 --- a/modules/swagger-codegen/src/main/resources/scala/model.mustache +++ b/modules/swagger-codegen/src/main/resources/scala/model.mustache @@ -1,16 +1,19 @@ {{>licenseInfo}} package {{package}} -{{#imports}}import {{import}} +{{#imports}} +import {{import}} {{/imports}} {{#models}} - {{#model}} - case class {{classname}} ( - {{#vars}}{{#description}}/* {{{description}}} */ - {{/description}}{{name}}: {{{datatype}}}{{#hasMore}},{{/hasMore}}{{^hasMore}}){{/hasMore}} + {{#vars}} + {{#description}} + /* {{{description}}} */ + {{/description}} + {{name}}: {{{datatype}}}{{#hasMore}},{{/hasMore}} {{/vars}} +) {{/model}} {{/models}} diff --git a/modules/swagger-codegen/src/main/resources/scalatra/model.mustache b/modules/swagger-codegen/src/main/resources/scalatra/model.mustache index c1a2f2585d..cf14e9a736 100644 --- a/modules/swagger-codegen/src/main/resources/scalatra/model.mustache +++ b/modules/swagger-codegen/src/main/resources/scalatra/model.mustache @@ -6,10 +6,13 @@ package {{package}} {{/imports}} {{#models}} - {{#model}} case class {{classname}} ( - {{#vars}}{{name}}: {{^required}}Option[{{/required}}{{datatype}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{#description}} // {{description}}{{/description}} + {{#vars}} + {{#description}} + /* {{{description}}} */ + {{/description}} + {{name}}: {{^required}}Option[{{/required}}{{datatype}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}} {{/vars}} ) {{/model}} diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala index d6c0d9c08b..b59e7f912b 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -6,8 +6,8 @@ package io.swagger.client.api import io.swagger.client.model.Pet -import java.io.File import io.swagger.client.model.ApiResponse +import java.io.File import io.swagger.client.core._ import io.swagger.client.core.CollectionFormats._ import io.swagger.client.core.ApiKeyLocations._ diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala index 31a9325c6f..0b996a89cc 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala @@ -9,11 +9,10 @@ package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime - case class ApiResponse ( code: Option[Int], `type`: Option[String], - message: Option[String]) - extends ApiModel + message: Option[String] +) extends ApiModel diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala index 6d14fc1227..48af020f18 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala @@ -9,10 +9,9 @@ package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime - case class Category ( id: Option[Long], - name: Option[String]) - extends ApiModel + name: Option[String] +) extends ApiModel diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala index 7ed7ae6109..3c2d7a255e 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala @@ -9,7 +9,6 @@ package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime - case class Order ( id: Option[Long], petId: Option[Long], @@ -17,19 +16,17 @@ case class Order ( shipDate: Option[DateTime], /* Order Status */ status: Option[OrderEnums.Status], - complete: Option[Boolean]) - extends ApiModel + complete: Option[Boolean] +) extends ApiModel object OrderEnums { type Status = Status.Value - object Status extends Enumeration { val Placed = Value("placed") val Approved = Value("approved") val Delivered = Value("delivered") } - } diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala index 0b8cf84d49..2adadb61ea 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala @@ -9,7 +9,6 @@ package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime - case class Pet ( id: Option[Long], category: Option[Category], @@ -17,19 +16,17 @@ case class Pet ( photoUrls: Seq[String], tags: Option[Seq[Tag]], /* pet status in the store */ - status: Option[PetEnums.Status]) - extends ApiModel + status: Option[PetEnums.Status] +) extends ApiModel object PetEnums { type Status = Status.Value - object Status extends Enumeration { val Available = Value("available") val Pending = Value("pending") val Sold = Value("sold") } - } diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala index 5a4b2f412c..6658e733b4 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala @@ -9,10 +9,9 @@ package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime - case class Tag ( id: Option[Long], - name: Option[String]) - extends ApiModel + name: Option[String] +) extends ApiModel diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala index 2dc7325c46..6db0c80fc3 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala @@ -9,7 +9,6 @@ package io.swagger.client.model import io.swagger.client.core.ApiModel import org.joda.time.DateTime - case class User ( id: Option[Long], username: Option[String], @@ -19,7 +18,7 @@ case class User ( password: Option[String], phone: Option[String], /* User Status */ - userStatus: Option[Int]) - extends ApiModel + userStatus: Option[Int] +) extends ApiModel diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala index 52974fb7e8..9feaf3603c 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -25,8 +25,8 @@ package io.swagger.client.api import io.swagger.client.model.Pet -import java.io.File import io.swagger.client.model.ApiResponse +import java.io.File import io.swagger.client.ApiInvoker import io.swagger.client.ApiException diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/ApiResponse.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/ApiResponse.scala index 49721a758a..99e93a5d34 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/ApiResponse.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/ApiResponse.scala @@ -25,9 +25,8 @@ package io.swagger.client.model - - case class ApiResponse ( code: Integer, -_type: String, -message: String) + _type: String, + message: String +) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Category.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Category.scala index c8843e065e..3499402cef 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Category.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Category.scala @@ -25,8 +25,7 @@ package io.swagger.client.model - - case class Category ( id: Long, -name: String) + name: String +) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Order.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Order.scala index 12fe2850ec..cffd221140 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Order.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Order.scala @@ -26,13 +26,12 @@ package io.swagger.client.model import org.joda.time.DateTime - - case class Order ( id: Long, -petId: Long, -quantity: Integer, -shipDate: DateTime, -/* Order Status */ + petId: Long, + quantity: Integer, + shipDate: DateTime, + /* Order Status */ status: String, -complete: Boolean) + complete: Boolean +) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Pet.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Pet.scala index 43420b1a9e..fc8f5e0976 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Pet.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Pet.scala @@ -25,13 +25,12 @@ package io.swagger.client.model - - case class Pet ( id: Long, -category: Category, -name: String, -photoUrls: List[String], -tags: List[Tag], -/* pet status in the store */ - status: String) + category: Category, + name: String, + photoUrls: List[String], + tags: List[Tag], + /* pet status in the store */ + status: String +) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Tag.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Tag.scala index 6cc351ba45..bb2bfae71e 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Tag.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/Tag.scala @@ -25,8 +25,7 @@ package io.swagger.client.model - - case class Tag ( id: Long, -name: String) + name: String +) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/User.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/User.scala index 4e80b6c669..cbbbded06f 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/User.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/model/User.scala @@ -25,15 +25,14 @@ package io.swagger.client.model - - case class User ( id: Long, -username: String, -firstName: String, -lastName: String, -email: String, -password: String, -phone: String, -/* User Status */ - userStatus: Integer) + username: String, + firstName: String, + lastName: String, + email: String, + password: String, + phone: String, + /* User Status */ + userStatus: Integer +) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala index 867e4605f2..9995f63012 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala @@ -25,8 +25,8 @@ package com.wordnik.client.api import com.wordnik.client.model.Pet -import java.io.File import com.wordnik.client.model.ApiResponse +import java.io.File import java.io.File diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala index c09ed4217e..13658983f7 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/ApiResponse.scala @@ -25,9 +25,8 @@ package com.wordnik.client.model - case class ApiResponse ( code: Option[Int], -_type: Option[String], -message: Option[String] + _type: Option[String], + message: Option[String] ) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Category.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Category.scala index 4bdadfbbe5..ab54f62c0e 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Category.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Category.scala @@ -25,8 +25,7 @@ package com.wordnik.client.model - case class Category ( id: Option[Long], -name: Option[String] + name: Option[String] ) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Order.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Order.scala index 6f399b0d1c..b55c2ab26e 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Order.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Order.scala @@ -26,12 +26,12 @@ package com.wordnik.client.model import java.util.Date - case class Order ( id: Option[Long], -petId: Option[Long], -quantity: Option[Int], -shipDate: Option[Date], -status: Option[String], // Order Status -complete: Option[Boolean] + petId: Option[Long], + quantity: Option[Int], + shipDate: Option[Date], + /* Order Status */ + status: Option[String], + complete: Option[Boolean] ) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Pet.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Pet.scala index 394ee79b7d..7d3c909359 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Pet.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Pet.scala @@ -25,12 +25,12 @@ package com.wordnik.client.model - case class Pet ( id: Option[Long], -category: Option[Category], -name: String, -photoUrls: List[String], -tags: Option[List[Tag]], -status: Option[String] // pet status in the store + category: Option[Category], + name: String, + photoUrls: List[String], + tags: Option[List[Tag]], + /* pet status in the store */ + status: Option[String] ) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Tag.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Tag.scala index a3d34e8d55..888c2f3134 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Tag.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/Tag.scala @@ -25,8 +25,7 @@ package com.wordnik.client.model - case class Tag ( id: Option[Long], -name: Option[String] + name: Option[String] ) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/User.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/User.scala index ff792d9137..3b4f9dc68e 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/User.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/model/User.scala @@ -25,14 +25,14 @@ package com.wordnik.client.model - case class User ( id: Option[Long], -username: Option[String], -firstName: Option[String], -lastName: Option[String], -email: Option[String], -password: Option[String], -phone: Option[String], -userStatus: Option[Int] // User Status + username: Option[String], + firstName: Option[String], + lastName: Option[String], + email: Option[String], + password: Option[String], + phone: Option[String], + /* User Status */ + userStatus: Option[Int] )