Skip to content

Commit

Permalink
Revert "Ignore non-content codecs when building multipart OpenAPI spec (
Browse files Browse the repository at this point in the history
#2745)"

This reverts commit c7f0598.
  • Loading branch information
987Nabil committed Jun 21, 2024
1 parent c7f0598 commit 0afa589
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2442,18 +2442,6 @@ object OpenAPIGenSpec extends ZIOSpecDefault {
| "components" : {}
|}""".stripMargin))
},
test("Non content codecs are ignored when building multipart schema") {
// We only test there is no exception when building the schema
val endpoint =
Endpoint(RoutePattern.POST / "post")
.in[Int]("foo")
.in[Boolean]("bar")
.query(QueryCodec.query("q"))
.out[Unit]

SwaggerUI.routes("docs/openapi", OpenAPIGen.fromEndpoints(endpoint))
assertCompletes
},
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,6 @@ object OpenAPIGen {
.nullable(optional(metadata))
.description(description(metadata))
.annotate(annotations)
case (JsonSchema.Object(p, _, r), JsonSchema.Null) =>
JsonSchema
.Object(p, Left(false), r)
.deprecated(deprecated(metadata))
.nullable(optional(metadata))
.description(description(metadata))
.annotate(annotations)
case (JsonSchema.Null, JsonSchema.Object(p, _, r)) =>
JsonSchema
.Object(p, Left(false), r)
.deprecated(deprecated(metadata))
.nullable(optional(metadata))
.description(description(metadata))
.annotate(annotations)
case _ => throw new IllegalArgumentException("Multipart content without name.")
}

Expand Down Expand Up @@ -812,7 +798,8 @@ object OpenAPIGen {
(
statusOrDefault,
(
AtomizedMetaCodecs.flatten(codec),
AtomizedMetaCodecs
.flatten(codec),
contentAsJsonSchema(codec, referenceType = referenceType) _,
),
)
Expand Down

0 comments on commit 0afa589

Please sign in to comment.