Skip to content

feat(OpenAPI): ✨ add feature to customize the response build…#28

Merged
BReijling merged 5 commits into
mainfrom
feature/custom-response-function
May 1, 2026
Merged

feat(OpenAPI): ✨ add feature to customize the response build…#28
BReijling merged 5 commits into
mainfrom
feature/custom-response-function

Conversation

@BReijling
Copy link
Copy Markdown
Owner

@BReijling BReijling commented Apr 30, 2026

This pull request introduces a new feature to support custom response object building in the OpenAPI Python-Flask controller template, along with documentation updates, a bug fix for authentication token refresh, and related test and versioning changes.

Custom Response Builder Feature:

  • Added support for a custom_response_builder function in the Python-Flask controller template, allowing users to specify a custom callable for building response objects via the x-alpha-custom-response-builder vendor extension in the OpenAPI spec. The function can be imported using x-alpha-import. This enables returning custom response formats or setting custom headers. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Documented the new extension x-alpha-custom-response-builder and provided a usage example in the API generation guide. [1] [2]

Bug Fixes:

  • Fixed an issue where, during authentication token refresh, the Identity object was not merged with user and group information from the database, which affected group-based permissions when refresh_identity_on_refresh was enabled.

Testing and Examples:

  • Added a custom_response_builder function for testing purposes and updated the OpenAPI test specification and tests to demonstrate and verify the custom response builder functionality. [1] [2] [3]

Documentation and Metadata:

  • Updated the changelog for version 0.6.1, README, and project version in pyproject.toml. Added a development status warning to the documentation and clarified response object return types in the docstring. [1] [2] [3] [4] [5]

Other:

  • Cleaned up unused code in test service utilities.…er per endpoint

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an OpenAPI vendor extension to let generated Python/Flask controllers delegate final response construction to a user-provided callable, with accompanying docs/tests and a patch version bump.

Changes:

  • Update the python-flask controller template to support x-alpha-custom-response-builder for building response objects.
  • Add test scaffolding + OpenAPI test spec updates demonstrating a custom response builder.
  • Documentation + release metadata updates (guides, docs landing page status warning, changelog, version bumps).

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/alpha/handlers/templates/python-flask/controller.mustache Adds response_object_function indirection to allow a custom response builder callable.
docs/guides/api-generation.md Documents the new x-alpha-custom-response-builder extension and example usage.
tests/openapi/specification/openapi.yaml Enables the custom response builder for the root test endpoint via vendor extensions.
src/alpha/utils/openapi_test/response.py Adds a test custom response builder implementation.
tests/openapi/test_responses.py Updates assertions to validate the custom response builder output for /.
src/alpha/utils/response_object.py Clarifies docstring return types for dict vs Flask response output.
docs/index.md Adds a development status admonition to the docs landing page.
src/alpha/utils/openapi_test/service.py Removes unused/commented-out helper code.
CHANGELOG.md Adds release notes for 0.6.1.
pyproject.toml Bumps project version to 0.6.1.
uv.lock Updates locked package version to 0.6.1.
README.md Minor whitespace cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/alpha/handlers/templates/python-flask/controller.mustache
Comment thread docs/index.md Outdated
Comment thread docs/guides/api-generation.md Outdated
Comment thread src/alpha/utils/openapi_test/response.py
BReijling and others added 3 commits April 30, 2026 14:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@KylianvG KylianvG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ziet er goed uit, lokaal ook al uitgeprobeerd en werkt zoals ik zou verwachten.

@BReijling BReijling merged commit b9cb242 into main May 1, 2026
4 checks passed
@BReijling BReijling deleted the feature/custom-response-function branch May 1, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants