-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[openapi] fix incomplete handling (fails on Schema.Lazy) for openapi'…
…s fromEndpoints (#2935) * add a failing test * fix code to pass failed test
- Loading branch information
Showing
4 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package zio.http.gen.model | ||
|
||
case class Data(name: String, meta: Meta) | ||
object Data { | ||
implicit val codec: zio.schema.Schema[Data] = zio.schema.DeriveSchema.gen[Data] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package zio.http.gen.model | ||
|
||
import zio.schema.annotation.{caseName, discriminatorName} | ||
import zio.schema.{DeriveSchema, Schema} | ||
|
||
@discriminatorName("type") | ||
sealed trait Meta | ||
object Meta { | ||
|
||
implicit val codec: Schema[Meta] = DeriveSchema.gen[Meta] | ||
|
||
@caseName("a") | ||
case class MetaA( | ||
t: String, | ||
i: Int, | ||
) extends Meta | ||
object MetaA { | ||
implicit val codec: Schema[MetaA] = DeriveSchema.gen[MetaA] | ||
} | ||
|
||
@caseName("b") | ||
case class MetaB( | ||
t: String, | ||
i: Int, | ||
) extends Meta | ||
object MetaB { | ||
implicit val codec: Schema[MetaB] = DeriveSchema.gen[MetaB] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters