You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*
* This file was generated by guardrail (https://github.com/guardrail-dev/guardrail).
* Modifications will be overwritten; instead edit the OpenAPI/Swagger spec file.
*/
package swagger.definitions
import cats.syntax.either._
import io.circe.syntax._
import cats.instances.all._
import _root_.swagger.Implicits._
case class X(links: Option[X.Links] = None)
object X {
implicit val encodeX: _root_.io.circe.Encoder.AsObject[X] = {
_root_.io.circe.Encoder.AsObject.instance[X](a => _root_.io.circe.JsonObject.fromIterable(_root_.scala.Vector(("links", a.links.asJson))))
}
implicit val decodeX: _root_.io.circe.Decoder[X] = new _root_.io.circe.Decoder[X] { final def apply(c: _root_.io.circe.HCursor): _root_.io.circe.Decoder.Result[X] = for (v0 <- c.downField("links").as[Option[X.Links]]) yield X(v0) }
}
As you can see, case class X contains a field of type Option[X.Links], but there is no Links type defined in the X object.
Obviously the oneOf thing is useless here and when I just write links: { "type": "object" } instead it works. But I'm using a schema provided by an API vendor that contains constructs like this, and I'd like to be able to use it as-is.
The text was updated successfully, but these errors were encountered:
Hey here,
Here's a schema that results in uncompilable code:
The code generated looks like this:
As you can see,
case class X
contains a field of typeOption[X.Links]
, but there is noLinks
type defined in theX
object.Obviously the
oneOf
thing is useless here and when I just writelinks: { "type": "object" }
instead it works. But I'm using a schema provided by an API vendor that contains constructs like this, and I'd like to be able to use it as-is.The text was updated successfully, but these errors were encountered: