diff --git a/openapi/build.gradle.kts b/openapi/build.gradle.kts index 7b22c303..6217481a 100644 --- a/openapi/build.gradle.kts +++ b/openapi/build.gradle.kts @@ -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")) diff --git a/openapi/src/OpenAPI.kt b/openapi/src/OpenAPI.kt index 11fcc682..04cb0140 100644 --- a/openapi/src/OpenAPI.kt +++ b/openapi/src/OpenAPI.kt @@ -162,7 +162,7 @@ internal fun T.toNonEmptyValues(filter: (KProperty1) -> 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 diff --git a/openapi/test/OpenAPITest.kt b/openapi/test/OpenAPITest.kt index abbcab17..f4fcde80 100644 --- a/openapi/test/OpenAPITest.kt +++ b/openapi/test/OpenAPITest.kt @@ -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(relaxed = true).apply { every { fullUrl(any()) } returns URI("https://base")