File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -197,5 +197,26 @@ fn get_webhooks(spec: &OpenApi) -> Vec<String> {
197197 }
198198 }
199199 }
200+
201+ // also check the spec.webhooks
202+ for ( _, webhook) in & spec. webhooks {
203+ let Some ( item) = webhook. as_item ( ) else {
204+ continue ;
205+ } ;
206+
207+ for ( _, op) in item. iter ( ) {
208+ let schema_ref = op
209+ . request_body
210+ . as_ref ( )
211+ . and_then ( |v| v. as_item ( ) )
212+ . and_then ( |v| v. content . get ( "application/json" ) )
213+ . and_then ( |v| v. schema . as_ref ( ) )
214+ . and_then ( |v| v. json_schema . clone ( ) . into_object ( ) . reference )
215+ . and_then ( |v| v. split ( '/' ) . next_back ( ) . map ( |v| v. to_string ( ) ) ) ;
216+ if let Some ( schema_ref) = schema_ref {
217+ referenced_components. insert ( schema_ref) ;
218+ }
219+ }
220+ }
200221 referenced_components. into_iter ( ) . collect :: < Vec < String > > ( )
201222}
You can’t perform that action at this time.
0 commit comments