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

[gen] Missing import for zio.schema._ in generated code when response content has application/json with type: object. #3218

Open
wi101 opened this issue Nov 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wi101
Copy link

wi101 commented Nov 22, 2024

Describe the bug
When generating Scala code from an OpenAPI JSON file containing a response with the following structure:

"content": {
  "application/json": {
    "schema": {
      "type": "object"
    }
  }
}

The generated code produces the following:

case class ResponseBody()
object ResponseBody {
  implicit val codec: Schema[ResponseBody] = DeriveSchema.gen[ResponseBody]
}

However, the required import import zio.schema._ is missing, causing compilation errors.

To Reproduce
Steps to reproduce the behaviour:

  1. Use an OpenAPI JSON file with a response schema like the one above.
  2. Run the code generation.
  3. Observe the missing import zio.schema._ in the generated code.

Expected behaviour
The generated code should include the necessary import for zio.schema._ to ensure it compiles successfully.

Used version
zio-http version: 3.0.1

@wi101 wi101 added the bug Something isn't working label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant