Skip to content

Commit 245d39f

Browse files
committed
code review
1 parent 30c520f commit 245d39f

File tree

6 files changed

+135
-3
lines changed

6 files changed

+135
-3
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/GenericResponseService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public class GenericResponseService {
106106
/**
107107
* The Controller infos.
108108
*/
109-
private final List<ControllerAdviceInfo> controllerInfos = new ArrayList<>();
109+
private final List<ControllerAdviceInfo> localExceptionHandlers = new ArrayList<>();
110110

111111
/**
112112
* The Controller advice infos.
@@ -243,7 +243,7 @@ public void buildGenericResponse(Components components, Map<String, Object> find
243243
controllerAdviceInfos.add(controllerAdviceInfo);
244244
}
245245
else {
246-
controllerInfos.add(controllerAdviceInfo);
246+
localExceptionHandlers.add(controllerAdviceInfo);
247247
}
248248
}
249249
}
@@ -646,7 +646,7 @@ else if (returnType instanceof ParameterizedType) {
646646
* @return the generic map response
647647
*/
648648
private synchronized Map<String, ApiResponse> getGenericMapResponse(Class<?> beanType) {
649-
List<ControllerAdviceInfo> controllerAdviceInfosInThisBean = controllerInfos.stream()
649+
List<ControllerAdviceInfo> controllerAdviceInfosInThisBean = localExceptionHandlers.stream()
650650
.filter(controllerInfo -> beanType.equals(controllerInfo.getControllerAdvice().getClass()))
651651
.collect(Collectors.toList());
652652

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package test.org.springdoc.api.app35;
2+
3+
import javax.persistence.Entity;
4+
import javax.persistence.GeneratedValue;
5+
import javax.persistence.GenerationType;
6+
import javax.persistence.Id;
7+
8+
import lombok.Data;
9+
10+
@Entity
11+
public @Data
12+
class ChildProperty {
13+
14+
@Id
15+
@GeneratedValue(strategy = GenerationType.AUTO)
16+
private long id;
17+
18+
private String name;
19+
20+
public long getId() {
21+
return id;
22+
}
23+
24+
public void setId(long id) {
25+
this.id = id;
26+
}
27+
28+
public String getName() {
29+
return name;
30+
}
31+
32+
public void setName(String name) {
33+
this.name = name;
34+
}
35+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package test.org.springdoc.api.app35;
2+
3+
import io.swagger.v3.oas.annotations.Hidden;
4+
5+
import org.springframework.data.repository.PagingAndSortingRepository;
6+
7+
@Hidden
8+
public interface ChildPropertyRepository extends PagingAndSortingRepository<ChildProperty, Long> {
9+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package test.org.springdoc.api.app35;
2+
3+
import javax.persistence.Entity;
4+
import javax.persistence.GeneratedValue;
5+
import javax.persistence.GenerationType;
6+
import javax.persistence.Id;
7+
import javax.persistence.JoinColumn;
8+
import javax.persistence.ManyToOne;
9+
10+
import lombok.Data;
11+
12+
@Entity
13+
public @Data
14+
class Property {
15+
16+
@Id
17+
@GeneratedValue(strategy = GenerationType.AUTO)
18+
private long id;
19+
20+
private String name;
21+
22+
@ManyToOne
23+
@JoinColumn(name = "child_property_id")
24+
private ChildProperty myChildPropertyName;
25+
26+
public long getId() {
27+
return id;
28+
}
29+
30+
public void setId(long id) {
31+
this.id = id;
32+
}
33+
34+
public String getName() {
35+
return name;
36+
}
37+
38+
public void setName(String name) {
39+
this.name = name;
40+
}
41+
42+
public ChildProperty getMyChildPropertyName() {
43+
return myChildPropertyName;
44+
}
45+
46+
public void setMyChildPropertyName(ChildProperty myChildPropertyName) {
47+
this.myChildPropertyName = myChildPropertyName;
48+
}
49+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package test.org.springdoc.api.app35;
2+
3+
import org.springframework.data.repository.PagingAndSortingRepository;
4+
5+
public interface PropertyRepository extends PagingAndSortingRepository<Property, Long> {
6+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
*
3+
* *
4+
* * *
5+
* * * * Copyright 2019-2020 the original author or authors.
6+
* * * *
7+
* * * * Licensed under the Apache License, Version 2.0 (the "License");
8+
* * * * you may not use this file except in compliance with the License.
9+
* * * * You may obtain a copy of the License at
10+
* * * *
11+
* * * * https://www.apache.org/licenses/LICENSE-2.0
12+
* * * *
13+
* * * * Unless required by applicable law or agreed to in writing, software
14+
* * * * distributed under the License is distributed on an "AS IS" BASIS,
15+
* * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* * * * See the License for the specific language governing permissions and
17+
* * * * limitations under the License.
18+
* * *
19+
* *
20+
*
21+
*/
22+
23+
package test.org.springdoc.api.app35;
24+
25+
import test.org.springdoc.api.AbstractSpringDocTest;
26+
27+
import org.springframework.boot.autoconfigure.SpringBootApplication;
28+
29+
public class SpringDocApp35Test extends AbstractSpringDocTest {
30+
31+
@SpringBootApplication
32+
static class SpringDocTestApp {}
33+
}

0 commit comments

Comments
 (0)