Merge pull request #329 from matrix-org/rav/basepath_in_swagger

Include the basePath in the path in swagger output
pull/977/head
Richard van der Hoff 9 years ago
commit d1fd9de10e

@ -45,7 +45,7 @@ os.chdir(templating_dir)
apis = MatrixUnits().load_swagger_apis() apis = MatrixUnits().load_swagger_apis()
output = { output = {
"basePath": "/_matrix/client/" + major_version, "basePath": "/",
"consumes": ["application/json"], "consumes": ["application/json"],
"produces": ["application/json"], "produces": ["application/json"],
"host": "localhost:8008", "host": "localhost:8008",
@ -63,7 +63,10 @@ with open(os.path.join(api_dir, 'client-server', 'definitions',
output['securityDefinitions'] = yaml.load(f) output['securityDefinitions'] = yaml.load(f)
for file, contents in apis.items(): for file, contents in apis.items():
basePath = contents['basePath']
for path, methods in contents["paths"].items(): for path, methods in contents["paths"].items():
path = (basePath + path).replace('%CLIENT_MAJOR_VERSION%',
major_version)
for method, spec in methods.items(): for method, spec in methods.items():
if "tags" in spec.keys(): if "tags" in spec.keys():
if path not in output["paths"]: if path not in output["paths"]:
@ -71,7 +74,6 @@ for file, contents in apis.items():
output["paths"][path][method] = spec output["paths"][path][method] = spec
print "Generating %s" % output_file print "Generating %s" % output_file
try: try:

Loading…
Cancel
Save