Open simingweng opened 6 years ago
The feature shall have dependency on Spring Boot 2.0.0 release, which is work-in-progress, but is soon due for first release. It is needed for the WebFlux auto configuration in the generated Spring Boot project.
Yes. A simple option should be enough, no need to pull a full library
Has there been any update on adding this option to generate a SpringBoot Reactive Server Stub using WebFlux? I saw the dependency is added to the pom.xml on the spring-boot library generation for SpringBoot 2.0.0, but I don't believe it was auto configured for WebFlux.
+1
+1
Is there any progress? @simingweng
+1 Is there any progress?
going to assign this to myself to work on it.
@HugoMario is not it possible to generate from an api
@ApiOperation(value = "Get Test Mono Api", nickname = "getTestData")
@ResponseBody
public Mono<UserTestDataResponse> getTestData(
@RequestParam(required = false, defaultValue = "0") final Integer userId,
@RequestParam(required = false) final Guid guidObjectJson,
@RequestHeader HttpHeaders httpHeaders) {
return testDataService.getData(userId, guidObjectJson);
}
The corresponding client with mvn generate-sources
?
@sbilello , no sure about it, i think that is something that can be customized in an own project.
btw, sorry for so late reply :/
Any update?
any update on this?
any update on this?
Well, I don't use swagger but I changed to the openapi code gen library to do that
@HugoMario is not it possible to generate from an api
@ApiOperation(value = "Get Test Mono Api", nickname = "getTestData") @ResponseBody public Mono<UserTestDataResponse> getTestData( @RequestParam(required = false, defaultValue = "0") final Integer userId, @RequestParam(required = false) final Guid guidObjectJson, @RequestHeader HttpHeaders httpHeaders) { return testDataService.getData(userId, guidObjectJson); }
The corresponding client with
mvn generate-sources
?
I tried something like this and it did the work, but it's clumsy.
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.29</version>
<configuration>
<language>spring</language>
<library>spring-mvc</library>
<generateSupportingFiles>false</generateSupportingFiles>
<generateApis>false</generateApis>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateModels>true</generateModels>
<generateModelDocumentation>true</generateModelDocumentation>
<generateApiDocumentation>true</generateApiDocumentation>
<detail>true</detail>
<additionalProperties>
<skipDefaultInterface>true</skipDefaultInterface>
</additionalProperties>
<configOptions>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<defaultInterfaces>false</defaultInterfaces>
<reactive>true</reactive>
<delegatePattern>true</delegatePattern>
<responseWrapper>reactor.core.publisher.Mono</responseWrapper>
</configOptions>
</configuration>
any update on this?
Well, I don't use swagger but I changed to the openapi code gen library to do that
Hey , I am trying to generate spring-webflux server stub , could you explain how you did that using openapi code gen library. Thank you !
@HugoMario is not it possible to generate from an api
@ApiOperation(value = "Get Test Mono Api", nickname = "getTestData") @ResponseBody public Mono<UserTestDataResponse> getTestData( @RequestParam(required = false, defaultValue = "0") final Integer userId, @RequestParam(required = false) final Guid guidObjectJson, @RequestHeader HttpHeaders httpHeaders) { return testDataService.getData(userId, guidObjectJson); }
The corresponding client with
mvn generate-sources
?I tried something like this and it did the work, but it's clumsy.
<groupId>io.swagger.codegen.v3</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>3.0.29</version> <configuration> <language>spring</language> <library>spring-mvc</library> <generateSupportingFiles>false</generateSupportingFiles> <generateApis>false</generateApis> <generateApiTests>false</generateApiTests> <generateModelTests>false</generateModelTests> <generateModels>true</generateModels> <generateModelDocumentation>true</generateModelDocumentation> <generateApiDocumentation>true</generateApiDocumentation> <detail>true</detail> <additionalProperties> <skipDefaultInterface>true</skipDefaultInterface> </additionalProperties> <configOptions> <dateLibrary>java8</dateLibrary> <interfaceOnly>true</interfaceOnly> <defaultInterfaces>false</defaultInterfaces> <reactive>true</reactive> <delegatePattern>true</delegatePattern> <responseWrapper>reactor.core.publisher.Mono</responseWrapper> </configOptions> </configuration>
Hello, do you mind sharing the steps to make this work , I cant even figure out where to put that code . Thank you !
@Latsode my snippet was for maven generation. Normally everything supported by the command line is supported by maven (the opposite is not guaranteed).
For command line client, there should be an equivalent like : --responseWrapper reactor.core.publisher.Mono
.
See https://openapi-generator.tech/docs/generators/spring/#config-options for complete list
Description
The feature request is to support generating a spring boot server stub based on the non-blocking Spring WebFlux framework.
Command line used for generation
add a new sub-template via
-l spring --library spring-webflux
Suggest a fix/enhancement
The straightforward approach would be following the annotated controller pattern, it would mean using Mono as type of @RequestBody annotated controller method argument, as well as Mono<ResponseEntity> as return type.
The functional endpoints flavour appears to require much more effort to implement, and it could be another sub template if it really makes sense to support it.