File tree Expand file tree Collapse file tree 4 files changed +132
-4
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/core
springdoc-openapi-security/src/test
java/test/org/springdoc/api/app2 Expand file tree Collapse file tree 4 files changed +132
-4
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ protected boolean isParamToIgnore(MethodParameter parameter) {
257
257
return true ;
258
258
if (parameter .getParameterAnnotation (PathVariable .class ) != null || parameter .getParameterAnnotation (RequestParam .class ) != null )
259
259
return false ;
260
- return PARAM_TYPES_TO_IGNORE .contains ( parameter .getParameterType ());
260
+ return PARAM_TYPES_TO_IGNORE .stream (). anyMatch ( paramToIgnore -> paramToIgnore . isAssignableFrom ( parameter .getParameterType () ));
261
261
}
262
262
263
263
private void setParams (Operation operation , List <Parameter > operationParameters , RequestBodyInfo requestBodyInfo ) {
Original file line number Diff line number Diff line change 18
18
19
19
package test .org .springdoc .api .app2 ;
20
20
21
+ import org .springframework .security .core .Authentication ;
21
22
import org .springframework .web .bind .annotation .GetMapping ;
22
23
import org .springframework .web .bind .annotation .RequestBody ;
23
24
import org .springframework .web .bind .annotation .RestController ;
24
25
25
26
@ RestController
26
27
public class HelloController {
27
28
29
+ @ GetMapping ("oneParameterAndAuthentication" )
30
+ public Object oneParameterAndAuthentication (@ RequestBody String req , Authentication authentication ) {
31
+ return null ;
32
+ }
28
33
29
- @ GetMapping
30
- public Object doPost ( @ RequestBody String req , org . springframework . security . core . Authentication auth ) {
34
+ @ GetMapping ( "noParametersAndAuthentication" )
35
+ public Object noParametersAndAuthentication ( Authentication authentication ) {
31
36
return null ;
32
37
}
33
38
39
+ @ GetMapping ("oneParameterAndUser" )
40
+ public Object oneParameterAndUser (@ RequestBody String req , User user ) {
41
+ return null ;
42
+ }
43
+
44
+ @ GetMapping ("noParametersAndUser" )
45
+ public Object noParametersAndUser (User user ) {
46
+ return null ;
47
+ }
34
48
}
Original file line number Diff line number Diff line change
1
+ package test .org .springdoc .api .app2 ;
2
+
3
+ import org .springframework .security .core .Authentication ;
4
+ import org .springframework .security .core .GrantedAuthority ;
5
+
6
+ import java .util .Collection ;
7
+
8
+ public class User implements Authentication {
9
+ @ Override
10
+ public Collection <? extends GrantedAuthority > getAuthorities () {
11
+ return null ;
12
+ }
13
+
14
+ @ Override
15
+ public Object getCredentials () {
16
+ return null ;
17
+ }
18
+
19
+ @ Override
20
+ public Object getDetails () {
21
+ return null ;
22
+ }
23
+
24
+ @ Override
25
+ public Object getPrincipal () {
26
+ return null ;
27
+ }
28
+
29
+ @ Override
30
+ public boolean isAuthenticated () {
31
+ return false ;
32
+ }
33
+
34
+ @ Override
35
+ public void setAuthenticated (boolean isAuthenticated ) throws IllegalArgumentException {
36
+
37
+ }
38
+
39
+ @ Override
40
+ public String getName () {
41
+ return null ;
42
+ }
43
+ }
Original file line number Diff line number Diff line change 15
15
}
16
16
],
17
17
"paths" : {
18
- "/" : {
18
+ "/oneParameterAndAuthentication " : {
19
19
"get" : {
20
20
"tags" : [
21
21
" hello-controller"
22
22
],
23
23
"operationId" : " doPost" ,
24
+ "operationId" : " oneParameterAndAuthentication" ,
24
25
"parameters" : [
25
26
{
26
27
"name" : " req" ,
44
45
}
45
46
}
46
47
}
48
+ },
49
+ "/noParametersAndAuthentication" : {
50
+ "get" : {
51
+ "tags" : [
52
+ " hello-controller"
53
+ ],
54
+ "operationId" : " noParametersAndAuthentication" ,
55
+ "responses" : {
56
+ "200" : {
57
+ "description" : " default response" ,
58
+ "content" : {
59
+ "*/*" : {
60
+ "schema" : {
61
+ "type" : " object"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ },
69
+ "/oneParameterAndUser" : {
70
+ "get" : {
71
+ "tags" : [
72
+ " hello-controller"
73
+ ],
74
+ "operationId" : " oneParameterAndUser" ,
75
+ "parameters" : [
76
+ {
77
+ "name" : " req" ,
78
+ "in" : " query" ,
79
+ "required" : true ,
80
+ "schema" : {
81
+ "type" : " string"
82
+ }
83
+ }
84
+ ],
85
+ "responses" : {
86
+ "200" : {
87
+ "description" : " default response" ,
88
+ "content" : {
89
+ "*/*" : {
90
+ "schema" : {
91
+ "type" : " object"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
98
+ },
99
+ "/noParametersAndUser" : {
100
+ "get" : {
101
+ "tags" : [
102
+ " hello-controller"
103
+ ],
104
+ "operationId" : " noParametersAndUser" ,
105
+ "responses" : {
106
+ "200" : {
107
+ "description" : " default response" ,
108
+ "content" : {
109
+ "*/*" : {
110
+ "schema" : {
111
+ "type" : " object"
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
47
118
}
48
119
},
49
120
"components" : {}
You can’t perform that action at this time.
0 commit comments