Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract routing API sorts routes. #1941

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion connexion/middleware/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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:
Expand Down
Loading