feat: migrate from Connexion 2.x to 3.x while maintaining backward compatibility#10
feat: migrate from Connexion 2.x to 3.x while maintaining backward compatibility#10avelino wants to merge 5 commits into
Conversation
…mpatibility This commit upgrades django-connexion to work with Connexion 3.x while preserving the same consumer API. The migration includes: - Direct OpenAPI specification parsing instead of relying on Connexion's AbstractAPI - Reimplemented DjangoApi class with backward-compatible interface - Enhanced security handler factory for Connexion 3.x architecture - Improved error handling and logging throughout the codebase - Added support for YAML and JSON OpenAPI specifications - Maintained the same URL pattern generation and Django integration - Updated version to 0.0.3 and dependency requirements The consumer API remains unchanged, ensuring existing applications can upgrade seamlessly without modifying their integration code. Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the project to support Connexion 3.x while preserving backward compatibility for existing consumers. Key changes include reimplementing the DjangoApi class with direct OpenAPI specification parsing, enhancing the security handler factory for the new Connexion architecture, and modernizing configuration files (pyproject.toml, requirements-dev.txt, GitHub workflows).
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py, setup.cfg | Removed in favor of the modern pyproject.toml configuration |
| requirements-dev.txt, pyproject.toml, .github workflows | Updated dependency management and CI configuration |
| django_connexion/tests/* | Adjustments in tests for improved type hints and consistent formatting |
| django_connexion/security/django_security_handler_factory.py | Reimplemented security handler factory with enhanced logging |
| django_connexion/apis/django_api.py | Refactored the DjangoApi, URL pattern generation, and response handling |
| README.md, Makefile, .flake8, LICENSE | Updated documentation and tooling configurations |
| json_getter=lambda: ( | ||
| request.content_type == "application/json" and json.loads(body) | ||
| if body | ||
| else None | ||
| ), |
There was a problem hiding this comment.
[nitpick] The inline conditional expression used in the json_getter lambda is somewhat hard to read. Consider refactoring it into a separate helper function or using a clearer conditional structure.
| json_getter=lambda: ( | |
| request.content_type == "application/json" and json.loads(body) | |
| if body | |
| else None | |
| ), | |
| json_getter=lambda: cls._get_json_body(request, body), |
| # Replace underscores with hyphens if needed | ||
| converted[key] = value |
There was a problem hiding this comment.
The comment suggests converting underscores to hyphens in path parameters, but the implementation currently just copies the value without modification. If this transformation is intended, please implement the conversion or update the comment accordingly.
| # Replace underscores with hyphens if needed | |
| converted[key] = value | |
| # Replace underscores with hyphens in keys | |
| converted[key.replace("_", "-")] = value |
|
I support the idea of improving the development experience by adding linting, type checking, Makefile-like task runners, and other configurations. However, I think these changes should be introduced in separate PRs. |
…django version Co-authored-by: Erle Carrara <carrara.erle@gmail.com>
This commit upgrades django-connexion to work with Connexion 3.x while preserving the same consumer API. The migration includes:
The consumer API remains unchanged, ensuring existing applications can upgrade seamlessly without modifying their integration code.
fixed: #11