Skip to content

Commit

Permalink
fix openapi generation
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith257 committed Aug 2, 2024
1 parent 88225f9 commit 027edbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2460,21 +2460,15 @@ object OpenAPIGenSpec extends ZIOSpecDefault {
SwaggerUI.routes("docs/openapi", OpenAPIGen.fromEndpoints(endpoint))
assertCompletes
},
// test("Ensure OpenAPI generation succeeds for Map[String, List[String]]") {
// val schema = Schema.map[String, List[String]]
// val openAPISchema = JsonSchema.fromZSchemaMulti(schema, SchemaStyle.Reference)
// assertTrue(openAPISchema != null)
// },
test("Ensure OpenAPI generation succeeds for Map[String, List[String]]") {
val schema = Schema.map[String, List[String]]
val openAPISchema = JsonSchema.fromZSchemaMulti(schema, SchemaStyle.Reference)
assertTrue(openAPISchema != null)
},
test("Failing test case for Map[String, List[String]] schema generation") {
val schema = Schema.map[String, List[String]]
val result =
try {
JsonSchema.fromZSchemaMulti(schema, SchemaStyle.Reference)
true
} catch {
case _: NoSuchElementException => false
}
assertTrue(result == false)
val result = scala.util.Try(JsonSchema.fromZSchemaMulti(schema, SchemaStyle.Reference))
assertTrue(result.isFailure)
},
test("Recursive schema") {
val endpoint = Endpoint(RoutePattern.POST / "folder")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ object JsonSchema {
Chunk.empty,
),
ref,
nested.children + (nested.rootRef.get -> nested.root),
nested.children ++ (nested.rootRef.map(_ -> nested.root)),
)
}
case Schema.Set(elementSchema, _) =>
Expand Down

0 comments on commit 027edbd

Please sign in to comment.