File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/api
springdoc-openapi-webmvc-core/src/test
java/test/org/springdoc/api/app54 Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 14
14
import org .springframework .core .annotation .AnnotationUtils ;
15
15
import org .springframework .util .AntPathMatcher ;
16
16
import org .springframework .util .CollectionUtils ;
17
+ import org .springframework .web .bind .annotation .RequestBody ;
17
18
import org .springframework .web .bind .annotation .RequestMapping ;
18
19
import org .springframework .web .bind .annotation .RequestMethod ;
19
20
import org .springframework .web .method .HandlerMethod ;
@@ -200,8 +201,8 @@ private void calculateJsonView(io.swagger.v3.oas.annotations.Operation apiOperat
200
201
*/
201
202
jsonViewAnnotationForRequestBody = (JsonView ) Arrays .stream (ReflectionUtils .getParameterAnnotations (method ))
202
203
.filter (arr -> Arrays .stream (arr )
203
- .anyMatch (annotation -> annotation .annotationType ()
204
- .equals (io .swagger .v3 .oas .annotations .parameters .RequestBody .class )))
204
+ .anyMatch (annotation -> ( annotation .annotationType ()
205
+ .equals (io .swagger .v3 .oas .annotations .parameters .RequestBody .class ) || annotation . annotationType (). equals ( RequestBody . class )) ))
205
206
.flatMap (Arrays ::stream ).filter (annotation -> annotation .annotationType ().equals (JsonView .class ))
206
207
.reduce ((a , b ) -> null ).orElse (jsonViewAnnotation );
207
208
}
Original file line number Diff line number Diff line change @@ -28,4 +28,9 @@ public ResponseEntity<MealParty> saveMealParty(@JsonView(Views.Public.class) @Re
28
28
return null ;
29
29
}
30
30
31
+ @ JsonView (Views .MealPartyAdmin .class )
32
+ @ PostMapping (value = "/new-parties" )
33
+ public ResponseEntity <MealParty > saveMealNewParty (@ JsonView (Views .Public .class ) @ org .springframework .web .bind .annotation .RequestBody MealParty p ) {
34
+ return null ;
35
+ }
31
36
}
Original file line number Diff line number Diff line change 71
71
}
72
72
}
73
73
}
74
+ },
75
+ "/new-parties" : {
76
+ "post" : {
77
+ "tags" : [
78
+ " hello-controller"
79
+ ],
80
+ "operationId" : " saveMealNewParty" ,
81
+ "requestBody" : {
82
+ "content" : {
83
+ "application/json" : {
84
+ "schema" : {
85
+ "$ref" : " #/components/schemas/MealParty_Public"
86
+ }
87
+ }
88
+ }
89
+ },
90
+ "responses" : {
91
+ "200" : {
92
+ "description" : " default response" ,
93
+ "content" : {
94
+ "*/*" : {
95
+ "schema" : {
96
+ "$ref" : " #/components/schemas/MealParty_MealPartyAdmin"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
74
103
}
75
104
},
76
105
"components" : {
You can’t perform that action at this time.
0 commit comments