Skip to content

#29 Fix typo in OpenAPISScalaCustomizer name #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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