Skip to content

Commit

Permalink
fix: use @casename annotations for openapi enums (#2544)
Browse files Browse the repository at this point in the history
* fix: use @casename annotations for openapi enums

* generateReadme
  • Loading branch information
runtologist authored Dec 8, 2023
1 parent 58e0594 commit 2f9ba86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ZIO HTTP is a scala library for building http apps. It is powered by ZIO and [Ne
Setup via `build.sbt`:

```scala
libraryDependencies += "dev.zio" %% "zio-http" % "3.0.0-RC3"
libraryDependencies += "dev.zio" %% "zio-http" % "3.0.0-RC4"
```

**NOTES ON VERSIONING:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ object JsonSchema {
case enum0: Schema.Enum[_] if refType != SchemaStyle.Inline && nominal(enum0).isDefined =>
JsonSchema.RefSchema(nominal(enum0, refType).get)
case enum0: Schema.Enum[_] if enum0.cases.forall(_.schema.isInstanceOf[CaseClass0[_]]) =>
JsonSchema.Enum(enum0.cases.map(c => EnumValue.Str(c.id)))
JsonSchema.Enum(
enum0.cases.map(c =>
EnumValue.Str(c.annotations.collectFirst { case caseName(name) => name }.getOrElse(c.id)),
),
)
case enum0: Schema.Enum[_] =>
val noDiscriminator = enum0.annotations.exists(_.isInstanceOf[noDiscriminator])
val discriminatorName0 =
Expand Down

0 comments on commit 2f9ba86

Please sign in to comment.