@@ -236,32 +236,6 @@ impl PathItem {
236236 HttpMethod :: Trace => self . trace = Some ( operation) ,
237237 }
238238 }
239-
240- /// Get an operation for a specific HTTP method
241- #[ must_use]
242- pub const fn get_operation ( & self , method : & HttpMethod ) -> Option < & Operation > {
243- match method {
244- HttpMethod :: Get => self . get . as_ref ( ) ,
245- HttpMethod :: Post => self . post . as_ref ( ) ,
246- HttpMethod :: Put => self . put . as_ref ( ) ,
247- HttpMethod :: Patch => self . patch . as_ref ( ) ,
248- HttpMethod :: Delete => self . delete . as_ref ( ) ,
249- HttpMethod :: Head => self . head . as_ref ( ) ,
250- HttpMethod :: Options => self . options . as_ref ( ) ,
251- HttpMethod :: Trace => self . trace . as_ref ( ) ,
252- }
253- }
254- }
255-
256- /// Route information (for internal use)
257- #[ derive( Debug , Clone ) ]
258- pub struct RouteInfo {
259- /// HTTP method
260- pub method : HttpMethod ,
261- /// Path
262- pub path : String ,
263- /// Operation information
264- pub operation : Operation ,
265239}
266240
267241#[ cfg( test) ]
@@ -404,65 +378,6 @@ mod tests {
404378 assert ! ( path_item. trace. is_some( ) ) ;
405379 }
406380
407- #[ test]
408- fn test_path_item_get_operation ( ) {
409- let mut path_item = PathItem :: default ( ) ;
410-
411- let operation = Operation {
412- operation_id : Some ( "test_operation" . to_string ( ) ) ,
413- tags : None ,
414- summary : None ,
415- description : None ,
416- parameters : None ,
417- request_body : None ,
418- responses : BTreeMap :: new ( ) ,
419- security : None ,
420- } ;
421-
422- // Initially, all operations should be None
423- assert ! ( path_item. get_operation( & HttpMethod :: Get ) . is_none( ) ) ;
424- assert ! ( path_item. get_operation( & HttpMethod :: Post ) . is_none( ) ) ;
425-
426- // Set GET operation
427- path_item. set_operation ( HttpMethod :: Get , operation. clone ( ) ) ;
428- let retrieved = path_item. get_operation ( & HttpMethod :: Get ) ;
429- assert ! ( retrieved. is_some( ) ) ;
430- assert_eq ! (
431- retrieved. unwrap( ) . operation_id,
432- Some ( "test_operation" . to_string( ) )
433- ) ;
434-
435- // Set POST operation
436- let mut operation_post = operation. clone ( ) ;
437- operation_post. operation_id = Some ( "post_operation" . to_string ( ) ) ;
438- path_item. set_operation ( HttpMethod :: Post , operation_post) ;
439- let retrieved = path_item. get_operation ( & HttpMethod :: Post ) ;
440- assert ! ( retrieved. is_some( ) ) ;
441- assert_eq ! (
442- retrieved. unwrap( ) . operation_id,
443- Some ( "post_operation" . to_string( ) )
444- ) ;
445-
446- // Test all methods
447- path_item. set_operation ( HttpMethod :: Put , operation. clone ( ) ) ;
448- assert ! ( path_item. get_operation( & HttpMethod :: Put ) . is_some( ) ) ;
449-
450- path_item. set_operation ( HttpMethod :: Patch , operation. clone ( ) ) ;
451- assert ! ( path_item. get_operation( & HttpMethod :: Patch ) . is_some( ) ) ;
452-
453- path_item. set_operation ( HttpMethod :: Delete , operation. clone ( ) ) ;
454- assert ! ( path_item. get_operation( & HttpMethod :: Delete ) . is_some( ) ) ;
455-
456- path_item. set_operation ( HttpMethod :: Head , operation. clone ( ) ) ;
457- assert ! ( path_item. get_operation( & HttpMethod :: Head ) . is_some( ) ) ;
458-
459- path_item. set_operation ( HttpMethod :: Options , operation. clone ( ) ) ;
460- assert ! ( path_item. get_operation( & HttpMethod :: Options ) . is_some( ) ) ;
461-
462- path_item. set_operation ( HttpMethod :: Trace , operation) ;
463- assert ! ( path_item. get_operation( & HttpMethod :: Trace ) . is_some( ) ) ;
464- }
465-
466381 #[ test]
467382 fn test_path_item_set_operation_overwrites ( ) {
468383 let mut path_item = PathItem :: default ( ) ;
0 commit comments