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) {
257257 return true ;
258258 if (parameter .getParameterAnnotation (PathVariable .class ) != null || parameter .getParameterAnnotation (RequestParam .class ) != null )
259259 return false ;
260- return PARAM_TYPES_TO_IGNORE .contains ( parameter .getParameterType ());
260+ return PARAM_TYPES_TO_IGNORE .stream (). anyMatch ( paramToIgnore -> paramToIgnore . isAssignableFrom ( parameter .getParameterType () ));
261261 }
262262
263263 private void setParams (Operation operation , List <Parameter > operationParameters , RequestBodyInfo requestBodyInfo ) {
Original file line number Diff line number Diff line change 1818
1919package test .org .springdoc .api .app2 ;
2020
21+ import org .springframework .security .core .Authentication ;
2122import org .springframework .web .bind .annotation .GetMapping ;
2223import org .springframework .web .bind .annotation .RequestBody ;
2324import org .springframework .web .bind .annotation .RestController ;
2425
2526@ RestController
2627public class HelloController {
2728
29+ @ GetMapping ("oneParameterAndAuthentication" )
30+ public Object oneParameterAndAuthentication (@ RequestBody String req , Authentication authentication ) {
31+ return null ;
32+ }
2833
29- @ GetMapping
30- public Object doPost ( @ RequestBody String req , org . springframework . security . core . Authentication auth ) {
34+ @ GetMapping ( "noParametersAndAuthentication" )
35+ public Object noParametersAndAuthentication ( Authentication authentication ) {
3136 return null ;
3237 }
3338
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+ }
3448}
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 1515 }
1616 ],
1717 "paths" : {
18- "/" : {
18+ "/oneParameterAndAuthentication " : {
1919 "get" : {
2020 "tags" : [
2121 " hello-controller"
2222 ],
2323 "operationId" : " doPost" ,
24+ "operationId" : " oneParameterAndAuthentication" ,
2425 "parameters" : [
2526 {
2627 "name" : " req" ,
4445 }
4546 }
4647 }
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+ }
47118 }
48119 },
49120 "components" : {}
You can’t perform that action at this time.
0 commit comments