Skip to content

Commit 778c056

Browse files
committed
Apply formatting consistent with swagger-scala-module
branch:
1 parent 8d2b064 commit 778c056

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

.scalafmt.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# https://scalameta.org/scalafmt/docs/configuration.html
2+
version = "3.5.9"
3+
runner.dialect = scala213source3
4+
maxColumn = 140
5+
project.git = true
6+
7+
spaces.afterKeywordBeforeParen = true
8+
align.preset = none
9+
align.openParenCallSite = false
10+
align.openParenDefnSite = false

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ releasePublishArtifactsAction := PgpKeys.publishSigned.value
3939

4040
pomExtra := {
4141
pomExtra.value ++ Group(
42-
<issueManagement>
42+
<issueManagement>
4343
<system>github</system>
4444
<url>https://github.com/swagger-api/swagger-enumeratum-module/issues</url>
4545
</issueManagement>

src/main/scala/com/github/swagger/enumeratum/converter/SwaggerEnumeratumModelConverter.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,3 @@ class SwaggerEnumeratumModelConverter extends ModelResolver(Json.mapper()) {
9797
case Some(arr) => arr.toList
9898
}
9999
}
100-

src/test/scala/com/github/swagger/enumeratum/converter/ModelPropertyParserTest.scala

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ package com.github.swagger.enumeratum.converter
22

33
import io.swagger.v3.core.converter._
44
import io.swagger.v3.oas.models.media._
5-
import models.{Ctx, ModelWCtxEnum, ModelWCtxEnumAndAnnotation, ModelWEnum, ModelWEnumAnnotated, ModelWEnumSet, ModelWOptionalEnum, OrderSize}
5+
import models.{
6+
Ctx,
7+
ModelWCtxEnum,
8+
ModelWCtxEnumAndAnnotation,
9+
ModelWEnum,
10+
ModelWEnumAnnotated,
11+
ModelWEnumSet,
12+
ModelWOptionalEnum,
13+
OrderSize
14+
}
615
import org.scalatest.OptionValues
716
import org.scalatest.flatspec.AnyFlatSpec
817
import org.scalatest.matchers.should.Matchers
@@ -14,32 +23,32 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
1423
val converter = ModelConverters.getInstance()
1524
val schemas = converter.readAll(classOf[ModelWEnum]).asScala.toMap
1625
val model = findModel(schemas, "ModelWEnum")
17-
model should be (defined)
26+
model should be(defined)
1827
model.get.getProperties should not be (null)
1928
val field = model.value.getProperties.get("field")
20-
field shouldBe a [StringSchema]
29+
field shouldBe a[StringSchema]
2130
field.asInstanceOf[StringSchema].getEnum.asScala shouldEqual OrderSize.values.map(_.entryName)
2231
nullSafeList(model.value.getRequired) shouldBe Seq("field")
2332
}
2433
it should "process Model with Optional Enumeratum Enum" in {
2534
val converter = ModelConverters.getInstance()
2635
val schemas = converter.readAll(classOf[ModelWOptionalEnum]).asScala.toMap
2736
val model = findModel(schemas, "ModelWOptionalEnum")
28-
model should be (defined)
37+
model should be(defined)
2938
model.get.getProperties should not be (null)
3039
val field = model.value.getProperties.get("field")
31-
field shouldBe a [StringSchema]
40+
field shouldBe a[StringSchema]
3241
field.asInstanceOf[StringSchema].getEnum.asScala shouldEqual OrderSize.values.map(_.entryName)
3342
nullSafeList(model.value.getRequired) shouldBe empty
3443
}
3544
it should "process Model with Enumeratum Set" in {
3645
val converter = ModelConverters.getInstance()
3746
val schemas = converter.readAll(classOf[ModelWEnumSet]).asScala.toMap
3847
val model = findModel(schemas, "ModelWEnumSet")
39-
model should be (defined)
48+
model should be(defined)
4049
model.get.getProperties should not be (null)
4150
val field = model.value.getProperties.get("sizes")
42-
field shouldBe a [ArraySchema]
51+
field shouldBe a[ArraySchema]
4352
val arraySchema = field.asInstanceOf[ArraySchema]
4453
arraySchema.getItems.getEnum.asScala shouldEqual OrderSize.values.map(_.entryName)
4554
nullSafeList(model.value.getRequired) shouldEqual List("sizes")
@@ -48,10 +57,10 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
4857
val converter = ModelConverters.getInstance()
4958
val schemas = converter.readAll(classOf[ModelWEnumAnnotated]).asScala.toMap
5059
val model = findModel(schemas, "ModelWEnumAnnotated")
51-
model should be (defined)
60+
model should be(defined)
5261
model.get.getProperties should not be (null)
5362
val field = model.value.getProperties.get("field")
54-
field shouldBe a [StringSchema]
63+
field shouldBe a[StringSchema]
5564
val schema = field.asInstanceOf[StringSchema]
5665
schema.getDescription shouldEqual "enum value"
5766
schema.getEnum.asScala shouldEqual OrderSize.values.map(_.entryName)
@@ -62,13 +71,13 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
6271
val schemas = converter.readAll(classOf[ModelWCtxEnum]).asScala.toMap
6372
schemas.keys should have size 1
6473
val model = findModel(schemas, "ModelWCtxEnum")
65-
model should be (defined)
74+
model should be(defined)
6675
model.get.getProperties should not be (null)
6776
val field = model.value.getProperties.get("field")
68-
field shouldBe a [StringSchema]
77+
field shouldBe a[StringSchema]
6978
val schema = field.asInstanceOf[StringSchema]
7079
schema.getDescription shouldEqual (null)
71-
schema.getDefault should be (null)
80+
schema.getDefault should be(null)
7281
schema.getEnum.asScala shouldEqual Ctx.Color.values.map(_.entryName)
7382
nullSafeList(model.value.getRequired) shouldBe Seq("field")
7483
}
@@ -86,8 +95,8 @@ class ModelPropertyParserTest extends AnyFlatSpec with Matchers with OptionValue
8695
val schema = field.asInstanceOf[StringSchema]
8796
schema.getDescription shouldEqual "An annotated field"
8897
schema.getName shouldEqual "field"
89-
schema.getDefault should be (null)
90-
schema.getDeprecated should be (null)
98+
schema.getDefault should be(null)
99+
schema.getDeprecated should be(null)
91100
schema.getEnum.asScala shouldEqual Ctx.Color.values.map(_.entryName)
92101
nullSafeList(model.value.getRequired) shouldBe Seq("field")
93102
}

0 commit comments

Comments
 (0)