модель swagger в класс случая scala
У меня есть проект sbt с akka http. Есть задача задокументировать api. Для этого я выбрал версию плагина swagger-akka-http 2.0.4. У меня есть такая модель чванства, и мне нужно преобразовать ее в класс случая scala
Rules2:
required:
- _1
type: object
properties:
_1:
type: array
items:
type: string
_2:
type: array
items:
type: string
_3:
type: array
items:
type: string
_4:
type: array
items:
type: string
_5:
type: array
items:
type: string
_6:
type: array
items:
type: string
_7:
type: array
items:
type: string
_8:
type: array
items:
type: string
_9:
type: array
items:
type: string
_10:
type: array
items:
type: string
_11:
type: array
items:
type: string
Я написал класс случая для этой модели
case class Rules2(
@ArraySchema(schema = new Schema(implementation = classOf[String], required = true)) _1: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _2: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _3: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _4: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _5: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _6: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _7: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _8: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _9: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _10: String,
@ArraySchema(schema = new Schema(implementation = classOf[String], required = false)) _11: String
)
и результат для этого класса случая:
Rules2:
required:
- _1
- _2
type: object
properties:
_1:
type: array
items:
type: string
_2:
type: array
items:
type: string
_3:
type: array
items:
type: string
_4:
type: array
items:
type: string
_5:
type: array
items:
type: string
_6:
type: array
items:
type: string
_7:
type: array
items:
type: string
_8:
type: array
items:
type: string
_9:
type: array
items:
type: string
_10:
type: array
items:
type: string
_11:
type: array
items:
type: string
но вы можете увидеть это в required
поле _2
появится столбец. Почему? Как я могу создать модель чванства только с одним обязательным полем?