@@ -428,17 +428,18 @@ def generate_service_operation(
428428 services = []
429429 service_ops = []
430430 for path_name , path in paths .items ():
431+ clean_path_name = clean_up_path_name (path_name )
431432 for http_operation in HTTP_OPERATIONS :
432433 op = path .__getattribute__ (http_operation )
433434 if op is None :
434435 continue
435436
436437 if library_config .include_sync :
437- sync_so = generate_service_operation (op , path_name , False )
438+ sync_so = generate_service_operation (op , clean_path_name , False )
438439 service_ops .append (sync_so )
439440
440441 if library_config .include_async :
441- async_so = generate_service_operation (op , path_name , True )
442+ async_so = generate_service_operation (op , clean_path_name , True )
442443 service_ops .append (async_so )
443444
444445 # Ensure every operation has a tag; fallback to "default" for untagged operations
@@ -489,3 +490,11 @@ def generate_service_operation(
489490 )
490491
491492 return services
493+
494+
495+ def clean_up_path_name (path_name : str ) -> str :
496+ # Clean up path name: only replace dashes inside curly brackets for f-string compatibility, keep other dashes
497+ def _replace_bracket_dashes (match ):
498+ return "{" + match .group (1 ).replace ("-" , "_" ) + "}"
499+
500+ return re .sub (r"\{([^}/]+)\}" , _replace_bracket_dashes , path_name )
0 commit comments