eikek / eikek/sbt-openapi-schema
allOf incorrectly uses discriminate type
- Dominant language
- Scala
- Stars
- 27
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
```
yield:
type: object
properties:
product:
type: string
required:
- product
YieldWithWeight:
allOf:
- $ref: '#/components/schemas/yield'
- type: object
properties:
weight:
type: integer
description: |
Weight amount
required:
- weight
```
Produces:
```scala
package org.myapi
sealed trait `yield` {
val product: String
}
object `yield` {
implicit val customConfig: io.circe.generic.extras.Configuration = io.circe.generic.extras.Configuration.default.withDefaults.withDiscriminator("type")
case class YieldWithWeight (
weight: Int, product: String
) extends `yield`
}
```
I would expect to be able and create both a `yield("foo")` and a `YieldWithWeight(10, "foo")` since both are valid objects. Need to think through how this code should actually be generated though (forgive the `yield`) was working on fixing the reserved words escaping.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.