Skip to content

Commit

Permalink
#29 Fix typo in OpenAPISScalaCustomizer name (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakipatryk committed Jan 9, 2024
1 parent 06baa25 commit 5cd85e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import za.co.absa.springdocopenapiscala.SpringdocOpenAPIVersionSpecificTypes._
* Glues all components of `springdoc-openapi-scala` together
* and enables additional customization (for example to set info).
*
* @param extraOpenAPICustomizers additional customizers that are executed after [[OpenAPISScalaCustomizer]]
* @param extraOpenAPICustomizers additional customizers that are executed after [[OpenAPIScalaCustomizer]]
*/
class Bundle(extraOpenAPICustomizers: Seq[OpenApiCustomizer] = Seq.empty) {

Expand All @@ -33,9 +33,9 @@ class Bundle(extraOpenAPICustomizers: Seq[OpenApiCustomizer] = Seq.empty) {
val modelRegistration: OpenAPIModelRegistration = new OpenAPIModelRegistration(components)

val customizer: OpenApiCustomizer = {
val openAPISScalaCustomizer = new OpenAPISScalaCustomizer(components)
val openAPIScalaCustomizer = new OpenAPIScalaCustomizer(components)

(openApi: OpenAPI) => (openAPISScalaCustomizer +: extraOpenAPICustomizers).foreach(_.customise(openApi))
(openApi: OpenAPI) => (openAPIScalaCustomizer +: extraOpenAPICustomizers).foreach(_.customise(openApi))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import za.co.absa.springdocopenapiscala.SpringdocOpenAPIVersionSpecificTypes.Ope

import scala.collection.JavaConverters._

class OpenAPISScalaCustomizer(components: Components) extends OpenApiCustomizer {
class OpenAPIScalaCustomizer(components: Components) extends OpenApiCustomizer {

override def customise(openAPIOutOfSync: OpenAPI): Unit = {
// this is needed as for some reason springdoc-openapi cache the `OpenAPI` at the beginning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ class OpenAPIScalaCustomizerSpec extends AnyFlatSpec {

it should "set `components` of its argument OpenAPI object to one injected via DI to the class" in {
val components = new Components().addSchemas("a", new Schema)
val openAPISScalaCustomizer = new OpenAPISScalaCustomizer(components)
val openAPIScalaCustomizer = new OpenAPIScalaCustomizer(components)

val openAPI = initializeOpenAPI

openAPISScalaCustomizer.customise(openAPI)
openAPIScalaCustomizer.customise(openAPI)

assert(openAPI.getComponents === components)
}

it should "convert all responses returning Unit (BoxedUnit reference) to empty response" in {
val components = new Components()
val openAPISScalaCustomizer = new OpenAPISScalaCustomizer(components)
val openAPIScalaCustomizer = new OpenAPIScalaCustomizer(components)

val openAPI = initializeOpenAPI

openAPISScalaCustomizer.customise(openAPI)
openAPIScalaCustomizer.customise(openAPI)

assert(
Option(openAPI.getPaths.get("/api/endpoint").getPost.getResponses.get("200").getContent).isEmpty
Expand Down

0 comments on commit 5cd85e3

Please sign in to comment.