File tree Expand file tree Collapse file tree
core/src/openapi/parse/schemas Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -232,6 +232,34 @@ paths:
232232 . contains( "ApiClient::new(\" https://api.example.com\" )" ) ) ;
233233 }
234234
235+
236+ #[ test]
237+ fn test_generate_docs_json_with_webhook ( ) {
238+ let yaml = r#"
239+ openapi: 3.1.0
240+ info:
241+ title: Test API
242+ version: 1.0.0
243+ webhooks:
244+ newPet:
245+ post:
246+ responses:
247+ '200':
248+ description: OK
249+ "# ;
250+ let args = ToDocsJsonArgs {
251+ input : "dummy" . into ( ) ,
252+ no_imports : false ,
253+ no_wrapping : false ,
254+ output : None ,
255+ } ;
256+
257+ let output = generate_docs_json ( yaml, & args) . unwrap ( ) ;
258+ // The webhook should be skipped, so operations should be empty
259+ assert_eq ! ( output. len( ) , 1 ) ;
260+ assert_eq ! ( output[ 0 ] . operations. len( ) , 0 ) ;
261+ }
262+
235263 #[ test]
236264 fn test_execute_with_file ( ) {
237265 use std:: io:: Write ;
Original file line number Diff line number Diff line change @@ -118,10 +118,7 @@ pub fn parse_openapi_spec_with_registry(
118118 . map_err ( |e| AppError :: General ( format ! ( "Failed to parse OpenAPI AST: {}" , e) ) ) ?;
119119
120120 let default_components = utoipa:: openapi:: Components :: new ( ) ;
121- let components = openapi
122- . components
123- . as_ref ( )
124- . unwrap_or ( & default_components) ;
121+ let components = openapi. components . as_ref ( ) . unwrap_or ( & default_components) ;
125122
126123 // 4. Initialize Resolution Context with Base URI ($self) from original Shim
127124 // If $self defined in Shim, use it as Base URI.
You can’t perform that action at this time.
0 commit comments