diff --git a/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinConfiguration.java b/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinConfiguration.java index 336ce173b..f74cc14f7 100644 --- a/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinConfiguration.java +++ b/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinConfiguration.java @@ -22,7 +22,6 @@ import io.swagger.v3.core.util.Json; import kotlin.Deprecated; import kotlin.coroutines.Continuation; -import kotlinx.coroutines.flow.Flow; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; @@ -38,8 +37,7 @@ public class SpringDocKotlinConfiguration { static { getConfig().addRequestWrapperToIgnore(Continuation.class) - .addDeprecatedType(Deprecated.class) - .addFluxWrapperToIgnore(Flow.class); + .addDeprecatedType(Deprecated.class); Json.mapper().registerModule(new KotlinModule()); } diff --git a/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinxConfiguration.java b/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinxConfiguration.java new file mode 100644 index 000000000..9a77896db --- /dev/null +++ b/springdoc-openapi-kotlin/src/main/java/org/springdoc/kotlin/SpringDocKotlinxConfiguration.java @@ -0,0 +1,21 @@ +package org.springdoc.kotlin; + +import kotlinx.coroutines.flow.Flow; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; + +import static org.springdoc.core.Constants.SPRINGDOC_ENABLED; +import static org.springdoc.core.SpringDocUtils.getConfig; + +@ConditionalOnClass(Flow.class) +@Configuration +@ConditionalOnProperty(name = SPRINGDOC_ENABLED, matchIfMissing = true) +public class SpringDocKotlinxConfiguration { + + static { + getConfig().addFluxWrapperToIgnore(Flow.class); + } + +} diff --git a/springdoc-openapi-kotlin/src/main/resources/META-INF/spring.factories b/springdoc-openapi-kotlin/src/main/resources/META-INF/spring.factories index 7ca2311c2..f71444942 100644 --- a/springdoc-openapi-kotlin/src/main/resources/META-INF/spring.factories +++ b/springdoc-openapi-kotlin/src/main/resources/META-INF/spring.factories @@ -1,2 +1,3 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.springdoc.kotlin.SpringDocKotlinConfiguration \ No newline at end of file +org.springdoc.kotlin.SpringDocKotlinConfiguration,\ +org.springdoc.kotlin.SpringDocKotlinxConfiguration \ No newline at end of file