Coverage for docs_src / generate_clients / tutorial004_py310.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1import json 1abcd
2from pathlib import Path 1abcd
4file_path = Path("./openapi.json") 1abcd
5openapi_content = json.loads(file_path.read_text()) 1abcd
7for path_data in openapi_content["paths"].values(): 1abcd
8 for operation in path_data.values(): 1abcd
9 tag = operation["tags"][0] 1abcd
10 operation_id = operation["operationId"] 1abcd
11 to_remove = f"{tag}-" 1abcd
12 new_operation_id = operation_id[len(to_remove) :] 1abcd
13 operation["operationId"] = new_operation_id 1abcd
15file_path.write_text(json.dumps(openapi_content)) 1abcd