Skip to content

Commit 81cbf19

Browse files
committed
add test
1 parent 1a68540 commit 81cbf19

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@ class ModelPropertyParserTest extends AnyFlatSpec with BeforeAndAfterEach with M
186186
// arraySchema.getItems shouldBe an[IntegerSchema]
187187
}
188188

189+
it should "process AddRequestOldStyleAnnotation" in new PropertiesScope[AddRequestOldStyleAnnotation] {
190+
val numbers = model.value.getProperties().get("numbers")
191+
numbers should not be (null)
192+
numbers shouldBe an[ArraySchema]
193+
val arraySchema = numbers.asInstanceOf[ArraySchema]
194+
arraySchema.getMinItems shouldEqual 2
195+
arraySchema.getMaxItems shouldEqual 10
196+
// TODO - this should be an IntegerSchema but the @ArraySchema annotation items schema is not being picked up
197+
// arraySchema.getItems shouldBe an[IntegerSchema]
198+
}
199+
189200
it should "process Model without any properties" in new TestScope {
190201
val schemas = converter.readAll(classOf[NoProperties]).asScala.toMap
191202
val model = schemas.get("NoProperties")

src/test/scala/models/AddRequest.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ import io.swagger.v3.oas.annotations.media.{ArraySchema, Schema}
44

55
case class AddRequest(@ArraySchema(items = new Schema(implementation = classOf[Long]), minItems = 2, maxItems = 10)
66
numbers: Array[Double])
7+
8+
case class AddRequestOldStyleAnnotation(@ArraySchema(schema = new Schema(implementation = classOf[Long]), minItems = 2, maxItems = 10)
9+
numbers: Array[Double])

0 commit comments

Comments
 (0)