Skip to content

Commit 71c0083

Browse files
committed
code review
1 parent fddc802 commit 71c0083

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/converters/PolymorphicModelConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
6161
private Schema composePolymorphicSchema(AnnotatedType type, Schema schema, Collection<Schema> schemas) {
6262
String ref = schema.get$ref();
6363
List<Schema> composedSchemas = schemas.stream()
64-
.filter(s -> s instanceof ComposedSchema)
64+
.filter(ComposedSchema.class::isInstance)
6565
.map(ComposedSchema.class::cast)
6666
.filter(s -> s.getAllOf() != null)
6767
.filter(s -> s.getAllOf().stream().anyMatch(s2 -> ref.equals(s2.get$ref())))

springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/core/DataRestResponseService.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private Type getType(MethodParameter methodParameterReturn, Class<?> domainType,
214214
Type returnType = ReturnTypeParser.resolveType(methodParameterReturn.getGenericParameterType(), methodParameterReturn.getContainingClass());
215215
Class returnedEntityType = domainType;
216216

217-
if (dataRestRepository!=null && ControllerType.PROPERTY.equals(dataRestRepository.getControllerType()))
217+
if (dataRestRepository != null && ControllerType.PROPERTY.equals(dataRestRepository.getControllerType()))
218218
returnedEntityType = dataRestRepository.getPropertyType();
219219

220220
if (returnType instanceof ParameterizedType) {
@@ -268,10 +268,10 @@ else if ((CollectionModel.class.equals(parameterizedType.getRawType())
268268
* @return the class
269269
*/
270270
private Class findType(RequestMethod requestMethod, DataRestRepository dataRestRepository) {
271-
if (ControllerType.ENTITY.equals(dataRestRepository.getControllerType())
271+
if (dataRestRepository != null && ControllerType.ENTITY.equals(dataRestRepository.getControllerType())
272272
&& Arrays.stream(requestMethodsEntityModel).anyMatch(requestMethod::equals))
273273
return EntityModel.class;
274-
else if (dataRestRepository!=null && ControllerType.PROPERTY.equals(dataRestRepository.getControllerType())) {
274+
else if (dataRestRepository != null && ControllerType.PROPERTY.equals(dataRestRepository.getControllerType())) {
275275
if (dataRestRepository.isCollectionLike())
276276
return CollectionModel.class;
277277
else if (dataRestRepository.isMap())
@@ -354,6 +354,20 @@ public MapModel(Map<? extends Object, ? extends Object> content, Link... links)
354354
public Map<? extends Object, ? extends Object> getContent() {
355355
return content;
356356
}
357+
358+
@Override
359+
public boolean equals(Object o) {
360+
if (this == o) return true;
361+
if (o == null || getClass() != o.getClass()) return false;
362+
if (!super.equals(o)) return false;
363+
MapModel mapModel = (MapModel) o;
364+
return Objects.equals(getContent(), mapModel.getContent());
365+
}
366+
367+
@Override
368+
public int hashCode() {
369+
return Objects.hash(super.hashCode(), getContent());
370+
}
357371
}
358372

359373
}

springdoc-openapi-data-rest/src/test/java/test/org/springdoc/api/app22/SpringDocApp22Test.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323

2424
package test.org.springdoc.api.app22;
2525

26-
import org.springframework.boot.autoconfigure.SpringBootApplication;
2726
import test.org.springdoc.api.AbstractSpringDocTest;
2827

28+
import org.springframework.boot.autoconfigure.SpringBootApplication;
29+
2930
public class SpringDocApp22Test extends AbstractSpringDocTest {
3031

3132
@SpringBootApplication

springdoc-openapi-security/src/main/java/org/springdoc/security/SpringDocSecurityConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ OpenApiCustomiser springSecurityLoginEndpointCustomiser(ApplicationContext appli
114114
for (SecurityFilterChain filterChain : filterChainProxy.getFilterChains()) {
115115
Optional<UsernamePasswordAuthenticationFilter> optionalFilter =
116116
filterChain.getFilters().stream()
117-
.filter(filterVar -> filterVar instanceof UsernamePasswordAuthenticationFilter)
117+
.filter(UsernamePasswordAuthenticationFilter.class::isInstance)
118118
.map(UsernamePasswordAuthenticationFilter.class::cast)
119119
.findAny();
120120
if (optionalFilter.isPresent()) {

0 commit comments

Comments
 (0)