guardrail-dev / guardrail-dev/guardrail
Anonymous swagger definitions generate subpar code
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
Following swagger code:
```yaml
swagger: '2.0'
paths:
/dummy:
post:
operationId: dummy
responses:
200:
schema:
type: object
properties:
foo:
type: string
bar:
type: string
```
generate this code:
```scala
sealed abstract class DummyResponse {
def fold[A](handleOk: io.circe.Json => A): A = this match {
case x: DummyResponse.Ok =>
handleOk(x.value)
}
}
object DummyResponse { case class Ok(value: io.circe.Json) extends DummyResponse }
```
I think we can do better - thoughts? I will try to tackle this myself, just want to check if there is a good reason for the code above to be generated in such a shape, without strict definition
Contributor guide
Assessment
This issue has not been assessed yet.