New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/webflux #2608
Feature/webflux #2608
Conversation
Add two interfaces : - NameValueExpression - PatternsRequestCondition Class from spring will be wrapped onto this classes
there is the first usable version of webflux project. there are a error while building swagger-ui webjar. the jar is empty. We must use old webjar before fix.
…ature/webflux Conflicts: .version gradle/dependencies.gradle gradle/wrapper/gradle-wrapper.properties springfox-spi/src/main/java/springfox/documentation/spi/service/contexts/Defaults.java springfox-spi/src/main/java/springfox/documentation/spi/service/contexts/Orderings.java springfox-spring-web/src/main/java/springfox/documentation/spring/web/plugins/CombinedRequestHandler.java springfox-spring-web/src/test/groovy/springfox/documentation/spring/web/scanners/ApiListingScannerSpec.groovy springfox-spring-webmvc/src/test/groovy/springfox/documentation/spring/web/plugins/DefaultRequestHandlerCombinerSpec.groovy springfox-spring-webmvc/src/test/groovy/springfox/documentation/spring/web/plugins/PathAndParametersEquivalenceSpec.groovy springfox-spring-webmvc/src/test/groovy/springfox/documentation/spring/web/readers/ApiModelReaderSpec.groovy springfox-swagger-ui/build.gradle springfox-swagger2/build.gradle springfox-swagger2/src/main/java/springfox/documentation/swagger2/annotations/EnableSwagger2WebMvc.java springfox-swagger2/src/main/java/springfox/documentation/swagger2/configuration/Swagger2DocumentationWebMvcConfiguration.java swagger-contract-tests/src/test/groovy/springfox/test/contract/swaggertests/Swagger2TestConfig.groovy
… test fixes/cases.
…e (instead of expected).
…n coverage report.
…n coverage report.
Codecov Report
@@ Coverage Diff @@
## master #2608 +/- ##
===========================================
- Coverage 95.15% 94.75% -0.4%
- Complexity 3105 3175 +70
===========================================
Files 343 359 +16
Lines 7863 8030 +167
Branches 599 614 +15
===========================================
+ Hits 7482 7609 +127
- Misses 235 268 +33
- Partials 146 153 +7 |
@ligasgr this is a terrific PR! It was one of the few PR's that is so easy to follow the changes. I'll polish and pull it in 🤘 |
@ligasgr Trying to close this I encountered one potential problem, would love to bounce that idea with you and possibly @deblockt The |
@dilipkrish Thanks for your kind words :) And sorry for late response. Regarding the PathProvider... it would be fairly simple to have the correct PathProviderFactory wired into the correct context by making it a This will not provide a solution to the issue of what the system should do when you have both spring-webmvc and spring-webflux on the classpath. There's a number of questions that need to be answered:
Currently applied solution avoids answering this stuff and requires exclusion of the "other dependency" which can be seen in contract test projects. |
@ligasgr I've merged it to master. Thank you and @deblockt very much for your contribution and efforts! I still have an outstanding question. I havent experimented or played with it yet, there is the |
@dilipkrish Thanks! Can't wait for the official release :) 👍
So this is just a first step. Once that issue will be sorted out it will get to the problem that you described before - not able to find the correct PathProviderFactory - there are two so you get the appropriate exception about non unique bean:
Btw. I now know that in situation when e.g. you use embedded tomcat as per instructions from webflux you still will not have the ServletContext available in the context so the factory fails:
If you exclude the WebMvcRelativePathProviderFactory from component scanning the context will start up fine and work fine. If you have both webmvc and webflux on your classpath and you're trying to use spring-boot-starter-webflux the context will not start up as it will complain about various reasons depending on your config but an example will be:
If you manually create a context without involving spring-boot-starter-webflux and use spring-boot-autoconfigure then your context will start up fine even when you have webmvc and webflux on the classpath. But the moment you have both @EnableSwagger2WebFlux and @EnableSwagger2WebMvc in your config you will start getting exception like:
Hope this helps answering your questions... Thanks, |
Hi! thank you so much for supporting webflux! |
@IsaacDeLaRosa I'll write up the documentation in a bit, but you would also need to add the spring-web dependency if you havent already added it. What are you seeing can you elaborate? |
What's this PR do/fix?
This PR provides support for webflux.
Are there unit tests? If not how should this be manually tested?
Existing unit tests were preserved and are still working. Added simplest contract tests for webflux.
Any background context you want to provide?
This PR supersedes PR #2233. It includes all the original changes plus necessary fixes and tests.
Not all of the tests moved in the original PR into the new project were easy to move back. The remaining ones would require creating a new layer of mixins that would not be tied to specific implementation (mvc/webflux). Unfortunately I don’t have that much time available to work on it.
Existing annotation was renamed @EnableSwagger2 -> @ EnableSwagger2WebMvc
and new annotation @EnableSwagger2WebFlux was added.
Please note that it is no longer enough to add dependency on:
you now also have to include either:
or
Documentation needs a lot of updates about dependencies and an example for web flux. The section 4.2. Component Model also needs an update.
What are the relevant issues?
#1773
#2233