Is there any way to sort the Namespace
entries after they've been added to the Api?
I'm following the documentation, and the flow (AFAIK) appears to be:
a) Create the API:
api = Api(version="1.0",
title="MahApi",
description="Mah Nice Little API",
doc="/swagger-ui",
strict_slashes=False)
b) Define namespaces:
ns = Namespace("sample_namespace",
description="sample module api",
path='/sample_one')
...
@ns.route('/test1', endpoint='sample_ns_test1')
class TestApi(Resource):
def get(self):
df = mah_service.get_some_data()
return jsonify(json.loads(df.to_json(orient='records')))
c) Add namespaces to the API:
api.add_namespace(mah_sample_ns)
Where I'm facing an issue (albeit it's a cosmetic yet annoying one) is that the namespaces are not being sorted in any way. It seems that I will need to sort the namespaces myself, manually, in code. Is there a more clever, pythonic way to get swagger to sort the namespaces?