The following schema:
{
"$ref": "#/definitions/FooBar",
"definitions": {
"FooBar": {
"oneOf": [
{ "$ref": "#/definitions/Foo" },
{ "$ref": "#/definitions/Bar" }
]
},
"Foo": {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
},
"Bar": {
"type": "object",
"properties": {
"bar": {
"type": "integer"
}
}
}
}
}
will yield this:
sealed trait FooBarUnion
case class FooBarFoo(x: Foo) extends FooBarUnion
case class FooBarBar(x: Bar) extends FooBarUnion
case class Foo(foo: Option[String] = None)
case class Bar(bar: Option[Int] = None)
It would be nice if the intermediary wrappers could be eliminated and this could be simplified to:
sealed trait FooBarUnion
case class Foo(foo: Option[String] = None) extends FooBarUnion
case class Bar(bar: Option[Int] = None) extends FooBarUnion
The following schema:
{ "$ref": "#/definitions/FooBar", "definitions": { "FooBar": { "oneOf": [ { "$ref": "#/definitions/Foo" }, { "$ref": "#/definitions/Bar" } ] }, "Foo": { "type": "object", "properties": { "foo": { "type": "string" } } }, "Bar": { "type": "object", "properties": { "bar": { "type": "integer" } } } } }will yield this:
It would be nice if the intermediary wrappers could be eliminated and this could be simplified to: