Skip to content

Commit

Permalink
upgrade swagger and ignore newly introduced SchemaResolution.AUTO in …
Browse files Browse the repository at this point in the history
…annotations
  • Loading branch information
angryziber committed Dec 13, 2024
1 parent c366905 commit aaae617
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openapi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies {
implementation(project(":server"))
api("io.swagger.core.v3:swagger-annotations:2.2.22")
api("io.swagger.core.v3:swagger-annotations:2.2.25")

testImplementation(project(":json"))
testImplementation(project(":jackson"))
Expand Down
2 changes: 1 addition & 1 deletion openapi/src/OpenAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ internal fun <T: Annotation> T.toNonEmptyValues(filter: (KProperty1<T, *>) -> Bo
publicProperties.filter(filter).forEach { p ->
when(val v = p.valueOf(this)) {
"", false, 0, Int.MAX_VALUE, Int.MIN_VALUE, 0.0, Void::class.java, AccessMode.AUTO, RequiredMode.AUTO, AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION -> null
is Enum<*> -> v.takeIf { v.name != "DEFAULT" }
is Enum<*> -> v.takeIf { v.name != "DEFAULT" && v.name != "AUTO" }
is Annotation -> v.toNonEmptyValues().takeIf { it.isNotEmpty() }
is Array<*> -> v.map { (it as? Annotation)?.toNonEmptyValues() ?: it }.takeIf { it.isNotEmpty() }
else -> v
Expand Down
2 changes: 1 addition & 1 deletion openapi/test/OpenAPITest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class OpenAPITest {
@Test fun `definition and security`() {
@SecurityScheme(name = "bearerApiKey", type = SecuritySchemeType.HTTP, scheme = "bearer", bearerFormat = "API-Key", paramName = "Authorization")
@OpenAPIDefinition(info = Info(title = "Mega API", version = "1.x"), security = [SecurityRequirement(name = "bearerApiKey")])
class MyRoutes {}
class MyRoutes

mockk<HttpExchange>(relaxed = true).apply {
every { fullUrl(any()) } returns URI("https://base")
Expand Down

0 comments on commit aaae617

Please sign in to comment.