diff --git a/zio-http/shared/src/main/scala/zio/http/endpoint/openapi/JsonSchema.scala b/zio-http/shared/src/main/scala/zio/http/endpoint/openapi/JsonSchema.scala index d2063c2bc8..0dc9d674ce 100644 --- a/zio-http/shared/src/main/scala/zio/http/endpoint/openapi/JsonSchema.scala +++ b/zio-http/shared/src/main/scala/zio/http/endpoint/openapi/JsonSchema.scala @@ -425,7 +425,7 @@ object JsonSchema { refType, seenWithCurrent, ) - nested.rootRef.map(k => nested.children + (k -> nested.root)).getOrElse(nested.children) + nested.rootRef.fold(ifEmpty = nested.children)(k => nested.children + (k -> nested.root)) } .toMap JsonSchemas(fromZSchema(record, SchemaStyle.Inline), ref, children)