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

Issue 2932 #3210

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ subprojects {
apply from: "$rootDir/gradle/documentation.gradle"

wrapper {
gradleVersion = '4.10.1'
gradleVersion = '5.5.1'
}

task codeCoverageReport(type: JacocoReport) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class FileVersionStrategy implements VersioningStrategy, GitTaggingSupport, GitV
project.logger.warn("[RELEASE] [DRYRUN] Will execute command: $commitChanges")
return
}
def proc = commitChanges.execute()
def proc = commitChanges.execute(null, versionFile.getParentFile())
def err = new StringBuilder()
def out = new StringBuilder()
proc.consumeProcessOutput(out, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import springfox.gradlebuild.BuildInfo
trait GitTaggingSupport {

String lastAnnotatedTag(Project project) {
def proc = "git -C ${project.getRootDir().toString()} describe --exact-match".execute();
def proc = "git describe --exact-match".execute(null, versionFile.getParentFile())
proc.waitFor();
if (proc.exitValue() == 0) {
return proc.text.trim()
}
proc = "git -C ${project.getRootDir().toString()} describe".execute()
proc = "git describe".execute(null, versionFile.getParentFile())
proc.waitFor()
if (proc.exitValue() == 0) {
return proc.text.trim()
Expand All @@ -27,7 +27,7 @@ trait GitTaggingSupport {
"[RELEASE] [DRYRUN] Would have executed -> $tagCommand")
return
}
def proc = tagCommand.execute()
def proc = tagCommand.execute(null, versionFile.getParentFile())
proc.waitFor()
def err = new StringBuilder()
def out = new StringBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ trait GitVersionParser {
def matcher = versionPart =~ pattern
if (!matcher.matches()) {
throw new IllegalArgumentException("Not a valid version. Expecting a version of form <MAJOR.MINOR.PATCH> where " +
"e.g. 1.0.0-SNAPSHOT, 1.0.0-1-g10a2eg: $versionPart")
"e.g. 1.0.0-SNAPSHOT, 1.0.0-1-g10a2eg: got '$versionPart'")
}
def patchComponents = matcher.collect { it }[0]
if (patchComponents.size() < 4) {
throw new IllegalArgumentException("Not a valid version. Expecting a version of form <MAJOR.MINOR.PATCH> where " +
"e.g. 1.0.0-SNAPSHOT, 1.0.0-1-g10a2eg: $versionPart")
"e.g. 1.0.0-SNAPSHOT, 1.0.0-1-g10a2eg: got '$versionPart'")
}
Integer patch = patchComponents[1].toInteger()
Integer count = ofNullable(patchComponents[3]).orElse("0").toInteger()
Expand All @@ -33,7 +33,7 @@ trait GitVersionParser {
def components = Stream.of(version.split("\\.")).collect(toList())
if (StreamSupport.stream(components.spliterator(), false).count() < 3) {
throw new IllegalArgumentException("Not a valid version. Expecting a version of form <MAJOR.MINOR.PATCH> where " +
"e.g. 1.0.0-SNAPSHOT, 1.0.0-1-g10a2eg: ${version}")
"e.g. 1.0.0-SNAPSHOT, 1.0.0-1-g10a2eg: got '${version}'")
}
def versions = components.iterator()
Integer major = versions.next().toInteger()
Expand Down
21 changes: 11 additions & 10 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ ext {
classmate = "1.4.0"
classGraph = "4.1.7"
equalsverifierVersion = '3.1.5'
groovy = "2.5.4"
jacocoVersion = '0.8.1'
groovy = "2.5.8"
jacocoVersion = '0.8.5'
jackson = '2.9.8'
jaxb = '2.3.1'
joda = "2.10.1"
jsonPath = "2.4.0"
jsonAssert = "1.5.0"
mapstruct = "1.3.0.Final"
mockito = "2.24.5"
mockito = "3.2.0"
objenesis = "3.0.1"
oasCore = "2.0.0-rc1"
servlet = "3.1.0"
slf4j = "1.7.25"
snakeyaml = '1.23'
spock = "1.3-RC1-groovy-2.5"
spring = "5.1.5.RELEASE"
springIntegration = "5.1.3.RELEASE"
springHateoas = "0.25.1.RELEASE"
springDataRest = "3.1.5.RELEASE"
springPluginVersion = "1.2.0.RELEASE"
spock = "1.3-groovy-2.5"
spring = "5.2.1.RELEASE"
springIntegration = "5.2.1.RELEASE"
springHateoas = "1.0.0.RELEASE"
springDataRest = "3.2.1.RELEASE"
springPluginVersion = "2.0.0.RELEASE"
swagger2Core = "1.5.20"
springBoot = "2.1.3.RELEASE"
springBoot = "2.2.1.RELEASE"
springfoxRfc6570Version = "1.0.0"
undercouch = "3.4.3"
validationApiVersion = '2.0.1.Final'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rootProject.name = 'springfox'
enableFeaturePreview('STABLE_PUBLISHING')

include 'springfox-core'
include 'springfox-spi'
include 'springfox-schema'
Expand Down
1 change: 1 addition & 0 deletions springfox-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ext {
}

dependencies {
compile "org.springframework:spring-webmvc:${spring}"
compile "net.bytebuddy:byte-buddy:${byteBuddyVersion}"
compile libs.core
compile libs.spring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private ClassSupport() {
throw new UnsupportedOperationException();
}

public static Optional<? extends Class> classByName(String className) {
public static Optional<? extends Class<?>> classByName(String className) {
try {
return of(Class.forName(className));
} catch (ClassNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public class Example {
private final String mediaType;

public Example(Object value) {
this.value = value;
this.mediaType = null;
this(null, value);
}

public Example(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
import static java.util.Collections.*;
import static springfox.documentation.builders.BuilderDefaults.*;

public class ListVendorExtension<T> implements VendorExtension<List<T>> {
private final List<T> values = new ArrayList<>();
public class ListVendorExtension implements VendorExtension {
private final List<Object> values = new ArrayList<>();
private final String name;

public ListVendorExtension(
String name,
List<T> values) {
List<?> values) {
this.name = name;
this.values.addAll(nullToEmptyList(values));
}
Expand All @@ -42,7 +42,7 @@ public String getName() {
}

@Override
public List<T> getValue() {
public List<?> getValue() {
return unmodifiableList(values);
}

Expand All @@ -63,7 +63,7 @@ public boolean equals(Object o) {
return false;
}

ListVendorExtension<?> that = (ListVendorExtension<?>) o;
ListVendorExtension that = (ListVendorExtension) o;

return Objects.equals(
values,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import static java.util.Collections.*;

public class ObjectVendorExtension implements VendorExtension<List<VendorExtension>> {
public class ObjectVendorExtension implements VendorExtension {
private final List<VendorExtension> properties = new ArrayList<>();
private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import java.util.Objects;

public class StringVendorExtension implements VendorExtension<String> {
public class StringVendorExtension implements VendorExtension {
private String name;
private String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
package springfox.documentation.service;

public interface VendorExtension<T> {
public interface VendorExtension {
String getName();

T getValue();
Object getValue();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import java.util.Set;

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

Set<String> getPatterns();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

package springfox.documentation.spring.wrapper;

public interface RequestMappingInfo<T> {
T getOriginalInfo();
public interface RequestMappingInfo {
Object getOriginalInfo();
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ApiInfoBuilderSpec extends Specification {
}

List<VendorExtension> extensions() {
return Arrays.asList(new ListVendorExtension<String>("test", Arrays.asList("Test")))
return Arrays.asList(new ListVendorExtension("test", Arrays.asList("Test")))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ class DocumentationBuilderSpec extends Specification {
}

List<VendorExtension> extensions() {
return Arrays.asList(new ListVendorExtension<String>("test", Arrays.asList("Test")))
return Arrays.asList(new ListVendorExtension("test", Arrays.asList("Test")))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ModelPropertyBuilderSpec extends Specification {
}

List<VendorExtension> extensions() {
return Arrays.asList(new ListVendorExtension<String>("test", Arrays.asList("Test")))
return Arrays.asList(new ListVendorExtension("test", Arrays.asList("Test")))
}

@Unroll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import spock.lang.Specification
class ListVendorExtensionSpec extends Specification {
def "List vendor extension adds and retrieves properties" () {
given:
ListVendorExtension sut = new ListVendorExtension<Integer>("Name", [1, 2])
ListVendorExtension sut = new ListVendorExtension("Name", [1, 2])
expect:
sut.getName().equals("Name")
sut.value.size() == 2
Expand All @@ -33,24 +33,24 @@ class ListVendorExtensionSpec extends Specification {

def "List vendor extension works with empty lists" () {
given:
ListVendorExtension sut = new ListVendorExtension<Integer>("Name", [])
ListVendorExtension sut = new ListVendorExtension("Name", [])
expect:
sut.getName().equals("Name")
sut.value.size() == 0
}

def "List vendor extension works with null" () {
given:
ListVendorExtension sut = new ListVendorExtension<Integer>("Name", null)
ListVendorExtension sut = new ListVendorExtension("Name", null)
expect:
sut.getName().equals("Name")
sut.value.size() == 0
}

def "Class .equals() and .hashCode() test" () {
given:
def sut = new ListVendorExtension<Integer>("Name", null)
def sutTest = new ListVendorExtension<Integer>(name, values)
def sut = new ListVendorExtension("Name", null)
def sutTest = new ListVendorExtension(name, values)
expect:
sut.equals(sutTest) == expectedEquality
sut.equals(sut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ApiKeySpec extends Specification {
]
}*/
def authorizer = new ObjectVendorExtension(authorizerKey)
def arns = new ListVendorExtension<String>(
def arns = new ListVendorExtension(
"providerARNS",
["arn:aws:cognito-idp:{region}:{account_id}:userpool/{user_pool_id}"])
authorizer.with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Set;

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

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

Expand All @@ -33,7 +33,7 @@ public PatternsRequestConditionWrapper(

@Override
public PatternsRequestCondition combine(
PatternsRequestCondition<org.springframework.web.servlet.mvc.condition.PatternsRequestCondition> other) {
PatternsRequestCondition other) {
if (other instanceof PatternsRequestConditionWrapper) {
return new PatternsRequestConditionWrapper(
this.condition.combine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
*/
package springfox.documentation.spring.data.rest;

import com.fasterxml.classmate.ResolvedType;
import org.springframework.aop.support.AopUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;
import springfox.documentation.service.ResolvedMethodParameter;
import static java.util.Optional.ofNullable;

import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import static java.util.Optional.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.method.HandlerMethod;

import com.fasterxml.classmate.ResolvedType;

import springfox.documentation.service.ResolvedMethodParameter;

class ActionSpecification {
private final Collection<RequestMethod> supportedMethods;
Expand Down Expand Up @@ -93,14 +94,4 @@ public ResolvedType getReturnType() {
public Optional<HandlerMethod> getHandlerMethod() {
return ofNullable(handlerMethod);
}

public Optional<Class<?>> getDeclaringClass() {
return getHandlerMethod().map(input -> {
Object bean = new OptionalDeferencer<>().convert(handlerMethod.getBean());
if (AopUtils.isAopProxy(bean)) {
return AopUtils.getTargetClass(bean);
}
return (Class<?>) bean;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
*/
package springfox.documentation.spring.data.rest;

import org.springframework.web.method.HandlerMethod;
import springfox.documentation.RequestHandler;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static springfox.documentation.spring.data.rest.SpecificationBuilder.entityAction;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static org.springframework.web.bind.annotation.RequestMethod.*;
import static springfox.documentation.spring.data.rest.SpecificationBuilder.*;
import org.springframework.web.method.HandlerMethod;

import springfox.documentation.RequestHandler;

class EntitySearchExtractor implements EntityOperationsExtractor {
@Override
public List<RequestHandler> extract(EntityContext context) {

return StreamSupport.stream(context.searchMappings().getExportedMappings().spliterator(), false)
return context.searchMappings().getExportedMappings()
.map(mapping -> {

final HandlerMethod handler = new HandlerMethod(context.getRepositoryInstance(), mapping.getMethod());
Expand Down