Skip to content
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

Merged
merged 46 commits into from
Aug 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
cf7d962
Remove spring-web-mvc deps from core
Jan 19, 2018
e945224
refactor(): remove dependencies to spring-mvc on swagger core
Jan 22, 2018
d5867d2
feature(webflux): add webflux project
Jan 23, 2018
f3e9aec
fix(): update build.gradle for swagger-ui jar generation
Jan 23, 2018
46a41b5
doc(): add install chapter on README
Jan 26, 2018
f3104ed
fix typo on README
deblockt Jan 26, 2018
950c37b
fix README
deblockt Jan 26, 2018
68d4081
fix checkstyle
Jan 29, 2018
a36ce88
Merge branch 'master' of https://github.com/deblockt/springfox
Jan 29, 2018
53fff4c
fix build command
Jan 29, 2018
4ee4c1b
Use real host instead of localhost:8080
Jan 29, 2018
7f99249
fix combine computation to not combine if two patterns are equals
Jan 29, 2018
3be8f1c
fix test for springfox-core
Jan 29, 2018
9f778e8
Merge branch 'master' into feature/webflux
deblockt Feb 6, 2018
0344724
Merge branch 'master' into feature/webflux
dilipkrish Feb 28, 2018
ea1f243
Merge branch 'master' of git://github.com/springfox/springfox into fe…
ligasgr Jul 29, 2018
857ea5c
Fixes after initial merge.
ligasgr Jul 30, 2018
7646f65
Restore testing.
ligasgr Jul 31, 2018
e35ca31
Add missing equals and hashCode.
ligasgr Jul 31, 2018
c1d5625
Make sure webflux context is conditional on webflux specific class.
ligasgr Jul 31, 2018
5c18ec5
Fix dependencies and exclusions.
ligasgr Jul 31, 2018
0997784
Initial draft of tests for webflux. Fixes of publishables. Additional…
ligasgr Aug 2, 2018
ce858d5
Move into package without uppercase letters.
ligasgr Aug 4, 2018
00c44c0
Removed unused constructor.
ligasgr Aug 4, 2018
130683a
Restore original README.md.
ligasgr Aug 4, 2018
ad6e07c
Updated webflux contract tests docs with actual state produced by cod…
ligasgr Aug 5, 2018
f4db486
Remove duplicated line.
ligasgr Aug 5, 2018
65beb48
Remove unused code. Use lambda syntax.
ligasgr Aug 5, 2018
526a010
Clean up the RequestMappingInfo todo. Remove unused class.
ligasgr Aug 7, 2018
718a96f
Unify the way the classes look like as much as possible.
ligasgr Aug 7, 2018
a1a3df6
Use unqualified classes.
ligasgr Aug 7, 2018
f20c4aa
Remove unused code.
ligasgr Aug 7, 2018
4a5fcde
Introduce new factory for path provider and inject it where needed.
ligasgr Aug 7, 2018
26a2f7b
Move DefaultConfiguration and DocumentationPluginsBootstrapper into c…
ligasgr Aug 7, 2018
2f3bdd4
Update tests with new factory for path provider. Remove unused code. …
ligasgr Aug 7, 2018
5b972c6
Move tests back into springfox-spring-web.
ligasgr Aug 8, 2018
687a9b3
Fix some of the tests after changes.
ligasgr Aug 8, 2018
ddfb39b
Move remaining tests into springfox-spring-web.
ligasgr Aug 9, 2018
b4c6649
Moved test back to correct package.
ligasgr Aug 9, 2018
82c39e9
Uncommented dependencies.
ligasgr Aug 9, 2018
86a5c0e
Move webflux petstore to separate package to allow coverage report cr…
ligasgr Aug 9, 2018
aed64b8
Rename implementation specific classes with prefix to avoid clashes i…
ligasgr Aug 9, 2018
d9b556d
Rename implementation specific classes with prefix to avoid clashes i…
ligasgr Aug 9, 2018
15717ac
Fix code quality issues.
ligasgr Aug 9, 2018
576ef1d
Merge remote-tracking branch 'upstream/master' into feature/webflux
ligasgr Aug 9, 2018
b2937a1
Remove duplicated dependency.
ligasgr Aug 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import org.gradle.api.Project
class ProjectDefinitions {
static publishables(Project project) {
return project.subprojects.findAll {
!['swagger-contract-tests', 'buildSrc', 'springfox-spring-config'].contains(it.name)
!['swagger-contract-tests', 'swagger-contract-tests-webflux', 'buildSrc', 'springfox-spring-config'].contains(it.name)
}
}
static publishable(Project project) {
!['swagger-contract-tests', 'buildSrc', 'springfox-spring-config'].contains(project.name)
!['swagger-contract-tests', 'swagger-contract-tests-webflux', 'buildSrc', 'springfox-spring-config'].contains(project.name)
}
}
31 changes: 30 additions & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ ext {
"org.springframework.hateoas:spring-hateoas:${springHateoas}",
"nl.jqno.equalsverifier:equalsverifier:${equalsverifierVersion}"
],
testNoHateoas : [
"org.springframework:spring-test:${spring}",
"cglib:cglib-nodep:$cglib",
"org.objenesis:objenesis:$objenesis",
"org.mockito:mockito-core:${mockito}",
"com.jayway.jsonpath:json-path:${jsonPath}",
"org.slf4j:slf4j-simple:${slf4j}",
"org.yaml:snakeyaml:${snakeyaml}",
"org.spockframework:spock-spring:${spock}",
"org.spockframework:spock-core:${spock}",
"org.codehaus.groovy:groovy-all:${groovy}",
"nl.jqno.equalsverifier:equalsverifier:${equalsverifierVersion}"
],
swagger2Core : [
"io.swagger:swagger-annotations:${swagger2Core}",
"io.swagger:swagger-models:${swagger2Core}"
Expand All @@ -53,20 +66,36 @@ ext {
"org.springframework.plugin:spring-plugin-metadata:${springPluginVersion}",
],
springProvided: [
"org.springframework:spring-core:$spring",
"org.springframework:spring-web:$spring",
"org.springframework:spring-context:$spring",
],
springProvidedWithMvc: [
"org.springframework:spring-core:$spring",
"org.springframework:spring-web:$spring",
"org.springframework:spring-webmvc:$spring",
"org.springframework:spring-context:$spring",
],
springProvidedWithFlux: [
"org.springframework:spring-core:$spring",
"org.springframework:spring-web:$spring",
"org.springframework:spring-webflux:$spring",
"org.springframework:spring-context:$spring",
],
springBootProvided: [
"org.springframework.boot:spring-boot-autoconfigure:$springBoot"
],
clientProvided: [
"javax.servlet:javax.servlet-api:$servlet",
"com.fasterxml.jackson.core:jackson-core:${jackson}",
"com.fasterxml.jackson.core:jackson-databind:${jackson}",
"joda-time:joda-time:$joda"
],
clientProvidedServlet: [
"com.fasterxml.jackson.core:jackson-core:${jackson}",
"com.fasterxml.jackson.core:jackson-databind:${jackson}",
"joda-time:joda-time:$joda",
"javax.servlet:javax.servlet-api:$servlet",
],
core : [
"com.fasterxml:classmate:${classmate}",
"org.slf4j:slf4j-api:${slf4j}",
Expand Down
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ include 'springfox-core'
include 'springfox-spi'
include 'springfox-schema'
include 'springfox-spring-web'
include 'springfox-spring-webmvc'
include 'springfox-spring-webflux'
include 'springfox-swagger-common'
include 'springfox-swagger1'
include 'springfox-swagger2'
include 'springfox-bean-validators'
include 'springfox-data-rest'
include 'springfox-swagger-ui'
include 'springfox-petstore'
include 'springfox-petstore-webflux'

// Auxiliary projects that are not published
include 'springfox-spring-config'
include 'swagger-contract-tests'
include 'swagger-contract-tests-webflux'
1 change: 1 addition & 0 deletions springfox-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ dependencies {
provided libs.clientProvided

testCompile libs.test
testCompile libs.clientProvidedServlet
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.NameValueExpression;
import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;

import springfox.documentation.annotations.Incubating;
import springfox.documentation.service.ResolvedMethodParameter;

import springfox.documentation.spring.wrapper.NameValueExpression;
import springfox.documentation.spring.wrapper.PatternsRequestCondition;
import springfox.documentation.spring.wrapper.RequestMappingInfo;

import java.lang.annotation.Annotation;
import java.util.Comparator;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package springfox.documentation.spring.wrapper;

public interface NameValueExpression<T> {

String getName();

T getValue();

boolean isNegated();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package springfox.documentation.spring.wrapper;

import java.util.Set;

public interface PatternsRequestCondition<T> {
PatternsRequestCondition combine(PatternsRequestCondition<T> other);

Set<String> getPatterns();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package springfox.documentation.spring.wrapper;

public interface RequestMappingInfo<T> {
T getOriginalInfo();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.NameValueExpression;
import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import springfox.documentation.RequestHandler;
import springfox.documentation.RequestHandlerKey;
import springfox.documentation.service.ResolvedMethodParameter;
import springfox.documentation.spring.wrapper.PatternsRequestConditionWrapper;
import springfox.documentation.spring.wrapper.NameValueExpression;
import springfox.documentation.spring.wrapper.PatternsRequestCondition;

import java.lang.annotation.Annotation;
import java.util.List;
Expand Down Expand Up @@ -67,7 +68,7 @@ public boolean isAnnotatedWith(Class<? extends Annotation> annotation) {

@Override
public PatternsRequestCondition getPatternsCondition() {
return requestMapping.getPatternsCondition();
return new PatternsRequestConditionWrapper(requestMapping.getPatternsCondition());
}

@Override
Expand Down Expand Up @@ -131,7 +132,7 @@ public <T extends Annotation> Optional<T> findControllerAnnotation(Class<T> anno
}

@Override
public RequestMappingInfo getRequestMapping() {
public springfox.documentation.spring.wrapper.RequestMappingInfo getRequestMapping() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
*
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package springfox.documentation.spring.wrapper;

import java.util.Set;

public class PatternsRequestConditionWrapper
implements PatternsRequestCondition<org.springframework.web.servlet.mvc.condition.PatternsRequestCondition> {

private org.springframework.web.servlet.mvc.condition.PatternsRequestCondition condition;

public PatternsRequestConditionWrapper(org.springframework.web.servlet.mvc.condition.PatternsRequestCondition condition) {
this.condition = condition;
}

@Override
public PatternsRequestCondition combine(PatternsRequestCondition<org.springframework.web.servlet.mvc.condition.PatternsRequestCondition> other) {
if (other instanceof PatternsRequestConditionWrapper) {
return new PatternsRequestConditionWrapper(this.condition.combine(((PatternsRequestConditionWrapper) other).condition));
}
return this;
}

@Override
public Set<String> getPatterns() {
return this.condition.getPatterns();
}
}
4 changes: 2 additions & 2 deletions springfox-data-rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ dependencies {
compile libs.core
compile libs.spring
compile project(':springfox-spi')
compile project(':springfox-spring-web')
compile project(':springfox-spring-webmvc')

compile "org.springframework.data:spring-data-rest-webmvc:$springDataRest"
compile "org.springframework.hateoas:spring-hateoas:${springHateoas}"

provided libs.springProvided
provided libs.springProvidedWithMvc

testCompile project(':springfox-core')
testCompile libs.test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.NameValueExpression;
import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import springfox.documentation.RequestHandler;
import springfox.documentation.RequestHandlerKey;
import springfox.documentation.service.ResolvedMethodParameter;
import springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper;
import springfox.documentation.spring.web.plugins.CombinedRequestHandler;
import springfox.documentation.spring.wrapper.NameValueExpression;
import springfox.documentation.spring.wrapper.PatternsRequestCondition;
import springfox.documentation.spring.wrapper.RequestMappingInfo;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
Expand Down Expand Up @@ -65,7 +66,9 @@ public boolean isAnnotatedWith(Class<? extends Annotation> annotation) {

@Override
public PatternsRequestCondition getPatternsCondition() {
return new PatternsRequestCondition(actionSpecification.getPath());
return new WebMvcPatternsRequestConditionWrapper(
new org.springframework.web.servlet.mvc.condition.PatternsRequestCondition(actionSpecification.getPath())
);
}

@Override
Expand Down
23 changes: 23 additions & 0 deletions springfox-petstore-webflux/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ext {
jdkVersion = 1.8
}
compileJava.options.encoding = 'UTF-8'

buildscript {
repositories {
jcenter()
}
}
repositories {
jcenter()
}

dependencies {
compile libs.spring
compile libs.springProvided
compile libs.swagger2Core
compile libs.core
compile project(':springfox-spi')
compile project(':springfox-core')
compile project(':springfox-spring-webflux')
}