Skip to content

Commit 8057baa

Browse files
committed
No documented way to handle Mono/Flux without Webflux. Fixes #523.
1 parent f24cdab commit 8057baa

File tree

5 files changed

+54
-16
lines changed

5 files changed

+54
-16
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocConfiguration.java

+23
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.springdoc.core.converters.ResponseSupportConverter;
4949
import org.springdoc.core.converters.SchemaPropertyDeprecatingConverter;
5050
import org.springdoc.core.converters.SortOpenAPIConverter;
51+
import org.springdoc.core.converters.WebFluxSupportConverter;
5152
import org.springdoc.core.customizers.ActuatorOpenApiCustomizer;
5253
import org.springdoc.core.customizers.ActuatorOperationCustomizer;
5354
import org.springdoc.core.customizers.DataRestDelegatingMethodParameterCustomizer;
@@ -69,6 +70,7 @@
6970
import org.springdoc.core.providers.SpringDataWebPropertiesProvider;
7071
import org.springdoc.core.providers.SpringWebProvider;
7172
import org.springdoc.core.providers.WebConversionServiceProvider;
73+
import reactor.core.publisher.Flux;
7274

7375
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
7476
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@@ -650,4 +652,25 @@ DelegatingMethodParameterCustomizer delegatingMethodParameterCustomizer(Optional
650652
return new DataRestDelegatingMethodParameterCustomizer(optionalSpringDataWebPropertiesProvider, optionalRepositoryRestConfiguration);
651653
}
652654
}
655+
656+
/**
657+
* The type Spring doc web flux support configuration.
658+
*/
659+
@ConditionalOnClass(Flux.class)
660+
static class SpringDocWebFluxSupportConfiguration {
661+
662+
/**
663+
* Web flux support converter web flux support converter.
664+
*
665+
* @param objectMapperProvider the object mapper provider
666+
* @return the web flux support converter
667+
*/
668+
@Bean
669+
@ConditionalOnMissingBean
670+
@Lazy(false)
671+
WebFluxSupportConverter webFluxSupportConverter(ObjectMapperProvider objectMapperProvider) {
672+
return new WebFluxSupportConverter(objectMapperProvider);
673+
}
674+
675+
}
653676
}
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
*/
2222

23-
package org.springdoc.webflux.core.converters;
23+
package org.springdoc.core.converters;
2424

2525
import java.util.Iterator;
2626

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/core/SpringDocWebFluxConfiguration.java

-15
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@
4242
import org.springdoc.core.customizers.RouterOperationCustomizer;
4343
import org.springdoc.core.filters.OpenApiMethodFilter;
4444
import org.springdoc.core.providers.ActuatorProvider;
45-
import org.springdoc.core.providers.ObjectMapperProvider;
4645
import org.springdoc.core.providers.SpringWebProvider;
4746
import org.springdoc.webflux.api.OpenApiActuatorResource;
4847
import org.springdoc.webflux.api.OpenApiWebfluxResource;
49-
import org.springdoc.webflux.core.converters.WebFluxSupportConverter;
5048

5149
import org.springframework.beans.factory.ObjectFactory;
5250
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
@@ -150,19 +148,6 @@ GenericResponseService responseBuilder(OperationService operationService, List<R
150148
return new GenericResponseService(operationService, returnTypeParsers, springDocConfigProperties, propertyResolverUtils);
151149
}
152150

153-
/**
154-
* Web flux support converter web flux support converter.
155-
*
156-
* @param objectMapperProvider the object mapper provider
157-
* @return the web flux support converter
158-
*/
159-
@Bean
160-
@ConditionalOnMissingBean
161-
@Lazy(false)
162-
WebFluxSupportConverter webFluxSupportConverter(ObjectMapperProvider objectMapperProvider) {
163-
return new WebFluxSupportConverter(objectMapperProvider);
164-
}
165-
166151
/**
167152
* Spring web provider spring web provider.
168153
*

springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/v30/app173/HelloController.java

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
package test.org.springdoc.api.v30.app173;
2424

25+
import reactor.core.publisher.Flux;
26+
2527
import org.springframework.web.bind.annotation.GetMapping;
2628
import org.springframework.web.bind.annotation.RestController;
2729

@@ -32,4 +34,9 @@ public class HelloController {
3234
public void printHello() {
3335
System.out.println("Hello");
3436
}
37+
38+
@GetMapping("/toto")
39+
public Flux<String> test() {
40+
return null;
41+
}
3542
}

springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app173.json

+23
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@
1111
}
1212
],
1313
"paths": {
14+
"/toto": {
15+
"get": {
16+
"tags": [
17+
"hello-controller"
18+
],
19+
"operationId": "test",
20+
"responses": {
21+
"200": {
22+
"description": "OK",
23+
"content": {
24+
"*/*": {
25+
"schema": {
26+
"type": "array",
27+
"items": {
28+
"type": "string"
29+
}
30+
}
31+
}
32+
}
33+
}
34+
}
35+
}
36+
},
1437
"/test": {
1538
"get": {
1639
"tags": [

0 commit comments

Comments
 (0)