From f255dc996a6d0cd6f71a551ba1210ea40844c0de Mon Sep 17 00:00:00 2001 From: mszymutk Date: Wed, 19 Jun 2024 11:15:43 +0200 Subject: [PATCH] Abstract routing API sorts routes. --- connexion/middleware/abstract.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connexion/middleware/abstract.py b/connexion/middleware/abstract.py index a5fd58aa1..c1bedf417 100644 --- a/connexion/middleware/abstract.py +++ b/connexion/middleware/abstract.py @@ -10,6 +10,7 @@ from connexion.operations import AbstractOperation from connexion.resolver import Resolver from connexion.spec import Specification +from connexion.utils import sort_routes logger = logging.getLogger(__name__) @@ -85,7 +86,8 @@ def add_paths(self, paths: t.Optional[dict] = None) -> None: Adds the paths defined in the specification as operations. """ paths = t.cast(dict, paths or self.specification.get("paths", dict())) - for path, methods in paths.items(): + for path in sort_routes(list(paths.keys())): + methods = paths[path] logger.debug("Adding %s%s...", self.base_path, path) for method in methods: