Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
swagger use default response messages is false by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sokomishalov committed Oct 22, 2019
1 parent 817f275 commit 8805f96
Showing 1 changed file with 32 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,42 @@ fun Docket.customizeDocket(
securityScheme: SecurityScheme? = null,
ignoredParameterTypes: List<Class<out Any>> = listOf(ServerHttpRequest::class.java, Continuation::class.java),
genericModelSubstitutes: List<Class<out Any>> = listOf(ResponseEntity::class.java),
useDefaultResponseMessages: Boolean = false,
title: String = EMPTY,
description: String = EMPTY,
contact: Contact = Contact("Sokolov Mikhael", "https://sokomishalov.github.io/about-me", "[email protected]"),
version: String = "1.0.0"
): Docket = this
.securityContexts(when {
securityContext != null -> listOf(securityContext)
else -> emptyList()
})
.securitySchemes(when {
securityScheme != null -> listOf(securityScheme)
else -> emptyList()
})
.ignoredParameterTypes(*ignoredParameterTypes.toTypedArray())
.genericModelSubstitutes(*genericModelSubstitutes.toTypedArray())
.alternateTypeRules(
newRule(
TYPE_RESOLVER.resolve(Flux::class.java, FilePart::class.java),
TYPE_RESOLVER.resolve(List::class.java, MultipartFile::class.java)
),
newRule(
TYPE_RESOLVER.resolve(Mono::class.java, FilePart::class.java),
TYPE_RESOLVER.resolve(MultipartFile::class.java)
)
)
.apiInfo(ApiInfoBuilder()
.title(title)
.description(description)
.contact(contact)
.version(version)
.build()
)
): Docket {
return this
.useDefaultResponseMessages(useDefaultResponseMessages)
.securityContexts(when {
securityContext != null -> listOf(securityContext)
else -> emptyList()
})
.securitySchemes(when {
securityScheme != null -> listOf(securityScheme)
else -> emptyList()
})
.ignoredParameterTypes(*ignoredParameterTypes.toTypedArray())
.genericModelSubstitutes(*genericModelSubstitutes.toTypedArray())
.alternateTypeRules(
newRule(
TYPE_RESOLVER.resolve(Flux::class.java, FilePart::class.java),
TYPE_RESOLVER.resolve(List::class.java, MultipartFile::class.java)
),
newRule(
TYPE_RESOLVER.resolve(Mono::class.java, FilePart::class.java),
TYPE_RESOLVER.resolve(MultipartFile::class.java)
)
)
.apiInfo(ApiInfoBuilder()
.title(title)
.description(description)
.contact(contact)
.version(version)
.build()
)
}


private val TYPE_RESOLVER = TypeResolver()

0 comments on commit 8805f96

Please sign in to comment.