Skip to content

Commit

Permalink
Merge pull request #608 from sklump/order-openapi-call-parms
Browse files Browse the repository at this point in the history
order swagger path parameters by location, required/optional, lexicog…
  • Loading branch information
andrewwhitehead authored Jul 16, 2020
2 parents f920027 + d1ae2c1 commit ee4fd1d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion aries_cloudagent/admin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,15 @@ async def start(self) -> None:
if plugin_registry:
plugin_registry.post_process_routes(self.app)

self.app._state["swagger_dict"].get("tags", []).sort(key=lambda t: t["name"])
# order tags alphabetically, parameters deterministically and pythonically
swagger_dict = self.app._state["swagger_dict"]
swagger_dict.get("tags", []).sort(key=lambda t: t["name"])
for path in swagger_dict["paths"].values():
for method_spec in path.values():
method_spec["parameters"].sort(
key=lambda p: (p["in"], not p["required"], p["name"])
)

self.site = web.TCPSite(runner, host=self.host, port=self.port)

try:
Expand Down

0 comments on commit ee4fd1d

Please sign in to comment.