-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The method isReturningUnit
in OpenAPIScalaCustomizer
can throw a NullPointerException
Case 1: No Content
object
Error messsage
java.lang.NullPointerException: Cannot invoke "scala.collection.IterableLike.exists(scala.Function1)" because the return value of "scala.collection.convert.Decorators$AsScala.asScala()" is null
at za.co.absa.ingestionaas.configservice.configuration.springdocopenapiscala.OpenAPIScalaCustomizer.$anonfun$fixResponsesReturningUnit$4(OpenAPIScalaCustomizer.scala:26)
Can happen for
@Operation(summary = "Delete entity", tags = Array("entities"))
@ApiResponses(
Array(
new ApiResponse(responseCode = "204", description = "No Content")
)
def deleteEntity(@PathVariable id: Long): CompletableFuture[Void]
Case 2: Existing Content
, but no schema
One could argue that in this case, a schema should be added, but I think a NPE should still not be thrown
Error message:
java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.media.Schema.get$ref()" because the return value of "io.swagger.v3.oas.models.media.MediaType.getSchema()" is null
at za.co.absa.ingestionaas.configservice.configuration.springdocopenapiscala.OpenAPIScalaCustomizer.$anonfun$fixResponsesReturningUnit$4(OpenAPIScalaCustomizer.scala:26)
Can happen for the following ApiResponse (Note: the example is shortened, but it doesn't matter if there's another ApiResponse that contains a schema)
@Operation(summary = "Get entity", tags = Array("entities"))
@ApiResponses(
Array(
new ApiResponse(
responseCode = "401",
description = "Unauthorized",
content = Array(new Content(examples = Array(new ExampleObject(value = """{
"error": "Unauthorized"
}"""))))
)
)
def getEntity(@PathVariable id: Long): CompletableFuture[Entity]
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working