forked from loafle/openapi-generator-original
update to sbt 0.13.0
This commit is contained in:
parent
bad8d7c4b3
commit
6747e3eb0b
@ -1 +1 @@
|
|||||||
sbt.version=0.12.4
|
sbt.version=0.13.0
|
@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.0")
|
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.1")
|
||||||
|
@ -2,9 +2,9 @@ organization := "{{package}}"
|
|||||||
|
|
||||||
name := "{{projectName}}-client"
|
name := "{{projectName}}-client"
|
||||||
|
|
||||||
libraryDependencies += "com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.0-WN4"
|
libraryDependencies += "com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.0-WN5"
|
||||||
|
|
||||||
libraryDependencies += "joda-time" % "joda-time" % "2.2"
|
libraryDependencies += "joda-time" % "joda-time" % "2.3"
|
||||||
|
|
||||||
libraryDependencies += "org.joda" % "joda-convert" % "1.3.1"
|
libraryDependencies += "org.joda" % "joda-convert" % "1.3.1"
|
||||||
|
|
||||||
|
@ -96,9 +96,8 @@ object SwaggerSerializers {
|
|||||||
ValidationMessage.validationMessages += msg
|
ValidationMessage.validationMessages += msg
|
||||||
}
|
}
|
||||||
|
|
||||||
class ApiListingSerializer extends CustomSerializer[ApiListing](formats => ({
|
class ApiListingSerializer extends CustomSerializer[ApiListing](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
ApiListing(
|
ApiListing(
|
||||||
(json \ "apiVersion").extractOrElse({
|
(json \ "apiVersion").extractOrElse({
|
||||||
!!(json, RESOURCE, "apiVersion", "missing required field", ERROR)
|
!!(json, RESOURCE, "apiVersion", "missing required field", ERROR)
|
||||||
@ -127,7 +126,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ApiListing =>
|
case x: ApiListing =>
|
||||||
implicit val fmts = formats
|
|
||||||
("apiVersion" -> x.apiVersion) ~
|
("apiVersion" -> x.apiVersion) ~
|
||||||
("resourcePath" -> x.resourcePath) ~
|
("resourcePath" -> x.resourcePath) ~
|
||||||
("swaggerVersion" -> x.swaggerVersion) ~
|
("swaggerVersion" -> x.swaggerVersion) ~
|
||||||
@ -147,9 +145,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ResourceListingSerializer extends CustomSerializer[ResourceListing](formats => ({
|
class ResourceListingSerializer extends CustomSerializer[ResourceListing](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
|
|
||||||
val apis = (json \ "apis").extract[List[ApiListingReference]]
|
val apis = (json \ "apis").extract[List[ApiListingReference]]
|
||||||
|
|
||||||
@ -167,7 +164,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ResourceListing =>
|
case x: ResourceListing =>
|
||||||
implicit val fmts = formats
|
|
||||||
("apiVersion" -> x.apiVersion) ~
|
("apiVersion" -> x.apiVersion) ~
|
||||||
("swaggerVersion" -> x.swaggerVersion) ~
|
("swaggerVersion" -> x.swaggerVersion) ~
|
||||||
("apis" -> {
|
("apis" -> {
|
||||||
@ -179,9 +175,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ApiListingReferenceSerializer extends CustomSerializer[ApiListingReference](formats => ({
|
class ApiListingReferenceSerializer extends CustomSerializer[ApiListingReference](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
ApiListingReference(
|
ApiListingReference(
|
||||||
(json \ "path").extractOrElse({
|
(json \ "path").extractOrElse({
|
||||||
!!(json, RESOURCE, "path", "missing required field", ERROR)
|
!!(json, RESOURCE, "path", "missing required field", ERROR)
|
||||||
@ -191,15 +186,13 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ApiListingReference =>
|
case x: ApiListingReference =>
|
||||||
implicit val fmts = formats
|
|
||||||
("path" -> x.path) ~
|
("path" -> x.path) ~
|
||||||
("description" -> x.description)
|
("description" -> x.description)
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ApiDescriptionSerializer extends CustomSerializer[ApiDescription](formats => ({
|
class ApiDescriptionSerializer extends CustomSerializer[ApiDescription](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
ApiDescription(
|
ApiDescription(
|
||||||
(json \ "path").extractOrElse({
|
(json \ "path").extractOrElse({
|
||||||
!!(json, RESOURCE_LISTING, "path", "missing required field", ERROR)
|
!!(json, RESOURCE_LISTING, "path", "missing required field", ERROR)
|
||||||
@ -210,7 +203,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ApiDescription =>
|
case x: ApiDescription =>
|
||||||
implicit val fmts = formats
|
|
||||||
("path" -> x.path) ~
|
("path" -> x.path) ~
|
||||||
("description" -> x.description) ~
|
("description" -> x.description) ~
|
||||||
("operations" -> {
|
("operations" -> {
|
||||||
@ -222,9 +214,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ResponseMessageSerializer extends CustomSerializer[ResponseMessage](formats => ({
|
class ResponseMessageSerializer extends CustomSerializer[ResponseMessage](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
ResponseMessage(
|
ResponseMessage(
|
||||||
(json \ "code").extractOrElse({
|
(json \ "code").extractOrElse({
|
||||||
!!(json, ERROR, "code", "missing required field", ERROR)
|
!!(json, ERROR, "code", "missing required field", ERROR)
|
||||||
@ -237,15 +228,13 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ResponseMessage =>
|
case x: ResponseMessage =>
|
||||||
implicit val fmts = formats
|
|
||||||
("code" -> x.code) ~
|
("code" -> x.code) ~
|
||||||
("message" -> x.message)
|
("message" -> x.message)
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class OperationSerializer extends CustomSerializer[Operation](formats => ({
|
class OperationSerializer extends CustomSerializer[Operation](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
|
|
||||||
val responseClass = (json \ "items") match {
|
val responseClass = (json \ "items") match {
|
||||||
case e: JObject => {
|
case e: JObject => {
|
||||||
@ -300,7 +289,6 @@ object SwaggerSerializers {
|
|||||||
case _ => toJsonSchema("type", x.responseClass) ~ ("format" -> JNothing)
|
case _ => toJsonSchema("type", x.responseClass) ~ ("format" -> JNothing)
|
||||||
}
|
}
|
||||||
|
|
||||||
implicit val fmts = formats
|
|
||||||
("method" -> x.method) ~
|
("method" -> x.method) ~
|
||||||
("summary" -> x.summary) ~
|
("summary" -> x.summary) ~
|
||||||
("notes" -> x.notes) ~
|
("notes" -> x.notes) ~
|
||||||
@ -317,9 +305,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ParameterSerializer extends CustomSerializer[Parameter](formats => ({
|
class ParameterSerializer extends CustomSerializer[Parameter](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
|
|
||||||
val output = new ListBuffer[String]
|
val output = new ListBuffer[String]
|
||||||
(json \ "enum") match {
|
(json \ "enum") match {
|
||||||
@ -416,7 +403,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: Parameter =>
|
case x: Parameter =>
|
||||||
implicit val fmts = formats
|
|
||||||
val output = ("name" -> x.name) ~
|
val output = ("name" -> x.name) ~
|
||||||
("description" -> x.description) ~
|
("description" -> x.description) ~
|
||||||
("defaultValue" -> x.defaultValue) ~
|
("defaultValue" -> x.defaultValue) ~
|
||||||
@ -435,9 +421,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ModelSerializer extends CustomSerializer[Model](formats => ({
|
class ModelSerializer extends CustomSerializer[Model](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
val output = new LinkedHashMap[String, ModelProperty]
|
val output = new LinkedHashMap[String, ModelProperty]
|
||||||
val required = (json \ "required").extract[Set[String]]
|
val required = (json \ "required").extract[Set[String]]
|
||||||
val properties = (json \ "properties") match {
|
val properties = (json \ "properties") match {
|
||||||
@ -467,7 +452,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: Model =>
|
case x: Model =>
|
||||||
implicit val fmts = formats
|
|
||||||
val required: List[String] = (for((name, prop) <- x.properties) yield {
|
val required: List[String] = (for((name, prop) <- x.properties) yield {
|
||||||
if(prop.required) Some(name)
|
if(prop.required) Some(name)
|
||||||
else None
|
else None
|
||||||
@ -488,10 +472,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ModelPropertySerializer extends CustomSerializer[ModelProperty] (formats => ({
|
class ModelPropertySerializer extends CustomSerializer[ModelProperty] (implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
|
|
||||||
val `type` = (json \ "$ref") match {
|
val `type` = (json \ "$ref") match {
|
||||||
case e: JString => e.s
|
case e: JString => e.s
|
||||||
case _ => {
|
case _ => {
|
||||||
@ -549,7 +531,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ModelProperty =>
|
case x: ModelProperty =>
|
||||||
implicit val fmts = formats
|
|
||||||
val output = toJsonSchema("type", x.`type`) ~
|
val output = toJsonSchema("type", x.`type`) ~
|
||||||
("description" -> x.description) ~
|
("description" -> x.description) ~
|
||||||
("items" -> Extraction.decompose(x.items))
|
("items" -> Extraction.decompose(x.items))
|
||||||
@ -564,9 +545,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class ModelRefSerializer extends CustomSerializer[ModelRef](formats => ({
|
class ModelRefSerializer extends CustomSerializer[ModelRef](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
|
|
||||||
val `type` = (json \ "type") match {
|
val `type` = (json \ "type") match {
|
||||||
case e: JString => e.s
|
case e: JString => e.s
|
||||||
@ -587,7 +567,6 @@ object SwaggerSerializers {
|
|||||||
)
|
)
|
||||||
}, {
|
}, {
|
||||||
case x: ModelRef =>
|
case x: ModelRef =>
|
||||||
implicit val fmts = formats
|
|
||||||
("type" -> {
|
("type" -> {
|
||||||
x.`type` match {
|
x.`type` match {
|
||||||
case e:String => Some(e)
|
case e:String => Some(e)
|
||||||
@ -598,9 +577,8 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
class AllowableValuesSerializer extends CustomSerializer[AllowableValues](formats => ({
|
class AllowableValuesSerializer extends CustomSerializer[AllowableValues](implicit formats => ({
|
||||||
case json =>
|
case json =>
|
||||||
implicit val fmts: Formats = formats
|
|
||||||
json \ "valueType" match {
|
json \ "valueType" match {
|
||||||
case JString(x) if x.equalsIgnoreCase("list") => {
|
case JString(x) if x.equalsIgnoreCase("list") => {
|
||||||
val output = new ListBuffer[String]
|
val output = new ListBuffer[String]
|
||||||
@ -622,7 +600,6 @@ object SwaggerSerializers {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
case AllowableListValues(values, "LIST") =>
|
case AllowableListValues(values, "LIST") =>
|
||||||
implicit val fmts = formats
|
|
||||||
("valueType" -> "LIST") ~ ("values" -> Extraction.decompose(values))
|
("valueType" -> "LIST") ~ ("values" -> Extraction.decompose(values))
|
||||||
case AllowableRangeValues(min, max) =>
|
case AllowableRangeValues(min, max) =>
|
||||||
("valueType" -> "RANGE") ~ ("min" -> min) ~ ("max" -> max)
|
("valueType" -> "RANGE") ~ ("min" -> min) ~ ("max" -> max)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user