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
With parameterized case class used as endpoint's output, Open API documentation generator crashes.
To Reproduce
Steps to reproduce the behaviour:
Run the following code:
//> using scala 3.4.0
//> using dep dev.zio::zio-http:3.0.0-RC6
import zio.http.Method
import zio.http.endpoint.Endpoint
import zio.http.endpoint.openapi.JsonSchema.SchemaStyle
import zio.http.endpoint.openapi.OpenAPIGen
import zio.schema.{DeriveSchema, Schema}
object OpenAPIBug:
final case class Item(isEdited: Boolean)
given Schema[Item] = DeriveSchema.gen[Item]
final case class Data[A](data: List[A])
given dataSchema[A: Schema]: Schema[Data[A]] = DeriveSchema.gen[Data[A]]
def main(args: Array[String]): Unit = OpenAPIGen.fromEndpoints(SchemaStyle.Reference, List(
Endpoint(Method.GET / "bug").out[Data[Item]]
))
Observe the following exception:
java.util.NoSuchElementException: None.get
at zio.http.endpoint.openapi.OpenAPIGen$$anon$7.applyOrElse(OpenAPIGen.scala:707)
(Caused by the fact that zio.http.endpoint.openapi.OpenAPI.Key.fromString("Data[A]") returns None.)
Expected behaviour
I expect correct Open API documentation to be generated, or, at a minimum, no crashes ;)
The text was updated successfully, but these errors were encountered:
Describe the bug
With parameterized case class used as endpoint's output, Open API documentation generator crashes.
To Reproduce
Steps to reproduce the behaviour:
(Caused by the fact that
zio.http.endpoint.openapi.OpenAPI.Key.fromString("Data[A]")
returnsNone
.)Expected behaviour
I expect correct Open API documentation to be generated, or, at a minimum, no crashes ;)
The text was updated successfully, but these errors were encountered: