Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect encoding of nullable non-required field with default #2025

Open
OlegYch opened this issue Sep 19, 2024 · 0 comments
Open

Incorrect encoding of nullable non-required field with default #2025

OlegYch opened this issue Sep 19, 2024 · 0 comments

Comments

@OlegYch
Copy link

OlegYch commented Sep 19, 2024

using spec like this

{
  "openapi": "3.0.2",
  "components": {
    "schemas": {
      "test": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "default": "",
            "example": "TEXT",
            "nullable": true
          }
        },
        "required": [
        ]
      }
    }
  }
}

and config like

addSbtPlugin("dev.guardrail" % "sbt-guardrail" % "1.0.0-M1")

libraryDependencies ++= Seq(
  "dev.guardrail" %% "guardrail-scala-pekko-http" % "1.0.0-M1",
)
Compile / guardrailTasks := List(
  ScalaClient(
    (Compile / resourceDirectory).value / "openapi" / "asd.json",
    pkg = "test",
    modules = List("pekko-http", "circe"),
  )
)

i get a compilation error

[error] 11 |case class Test(method: _root_.test.support.Presence[Option[String]] = _root_.test.support.Presence.Present(""))
[error]    |                                 Found:    ("" : String)
[error]    |                                 Required: Option[String]
[```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant