From f46a2a7f2b7cc164e82efc146eae781dc6ab36f1 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 6 May 2016 12:35:27 +0100 Subject: [PATCH] Include the basePath in the path in swagger output This fixes both SPEC-393, and ORG-52. --- scripts/dump-swagger.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/dump-swagger.py b/scripts/dump-swagger.py index d706737a..9ac1d08e 100755 --- a/scripts/dump-swagger.py +++ b/scripts/dump-swagger.py @@ -45,7 +45,7 @@ os.chdir(templating_dir) apis = MatrixUnits().load_swagger_apis() output = { - "basePath": "/_matrix/client/" + major_version, + "basePath": "/", "consumes": ["application/json"], "produces": ["application/json"], "host": "localhost:8008", @@ -63,7 +63,10 @@ with open(os.path.join(api_dir, 'client-server', 'definitions', output['securityDefinitions'] = yaml.load(f) for file, contents in apis.items(): + basePath = contents['basePath'] for path, methods in contents["paths"].items(): + path = (basePath + path).replace('%CLIENT_MAJOR_VERSION%', + major_version) for method, spec in methods.items(): if "tags" in spec.keys(): if path not in output["paths"]: @@ -71,7 +74,6 @@ for file, contents in apis.items(): output["paths"][path][method] = spec - print "Generating %s" % output_file try: