Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update swagger-parser to fix definition parse bug #41

Merged
merged 3 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ val codegenSettings = Seq(
),
libraryDependencies ++= testDependencies ++ Seq(
"org.scalameta" %% "scalameta" % "2.0.1"
, "io.swagger" % "swagger-parser" % "1.0.32"
, "io.swagger" % "swagger-parser" % "1.0.34"
, "org.tpolecat" %% "atto-core" % "0.6.1"
, "org.typelevel" %% "cats-core" % catsVersion
, "org.typelevel" %% "cats-kernel" % catsVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ object SwaggerUtil {
Target.pure(Resolved(t"Double", None, Default(d).extract[Double].map(Lit.Double(_))))
case d: DecimalProperty =>
Target.pure(Resolved(t"BigDecimal", None, None))
case u: UntypedProperty =>
Target.pure(Resolved(t"io.circe.Json", None, None))
case p: AbstractProperty if p.getType.toLowerCase == "integer" =>
Target.pure(Resolved(t"BigInt", None, None))
case p: AbstractProperty if p.getType.toLowerCase == "number" =>
Expand Down
13 changes: 7 additions & 6 deletions src/test/scala/generators/AkkaHttp/PropertyExtractors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class PropertyExtractors extends FunSuite with Matchers {
| format: double
| number_property:
| type: number
| property:
| untyped_property:
| default: "what"
| object_property:
| type: object
Expand Down Expand Up @@ -77,6 +77,7 @@ class PropertyExtractors extends FunSuite with Matchers {
longProperty: Option[Long] = None, intProperty: Option[Int] = None,
integerProperty: Option[BigInt] = None, floatProperty: Option[Float] = None,
doubleProperty: Option[Double] = None, numberProperty: Option[BigDecimal] = None,
untypedProperty: Option[io.circe.Json] = None,
objectProperty: Option[io.circe.Json] = None
/*, refProperty: Option[ref_target_property] = None, refTargetProperty: Option[String] = None,
arrayProperty: Option[IndexedSeq[ref_target_property]] = Option(IndexedSeq.empty)
Expand All @@ -88,20 +89,20 @@ class PropertyExtractors extends FunSuite with Matchers {
object Something {
implicit val encodeSomething = {
val readOnlyKeys = Set[String]()
Encoder.forProduct9(
Encoder.forProduct10(
"boolean_value", "string_value", "long_property", "int_property", "integer_property", "float_property",
"double_property", "number_property", "object_property"
"double_property", "number_property", "untyped_property", "object_property"
/*, "ref_property", "ref_target_property", "array_property" */
)( (o: Something) => (
o.booleanValue, o.stringValue, o.longProperty, o.intProperty, o.integerProperty, o.floatProperty,
o.doubleProperty, o.numberProperty, o.objectProperty
o.doubleProperty, o.numberProperty, o.untypedProperty, o.objectProperty
/* , o.refProperty, o.refTargetProperty, o.arrayProperty */
)
).mapJsonObject(_.filterKeys(key => !(readOnlyKeys contains key)))
}
implicit val decodeSomething = Decoder.forProduct9(
implicit val decodeSomething = Decoder.forProduct10(
"boolean_value", "string_value", "long_property", "int_property", "integer_property", "float_property",
"double_property", "number_property", "object_property"
"double_property", "number_property", "untyped_property", "object_property"
/*, "ref_property", "ref_target_property", "array_property" */
)(Something.apply _)
}
Expand Down