Repository navigation
feat(api)!: keep operation fields set in specs - #310
Merged
Merged
Conversation
add_operation_fields replaced fields that operations set themselves, so that, e.g., single operations could not be routed to another controller module than the one configured for all operations. Only add fields that operations do not set. BREAKING CHANGE: fields set by operations are no longer replaced by add_operation_fields. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR changes add_operation_fields from an overwrite operation to a defaulting operation: each configured field is applied only when absent, allowing individual OpenAPI operations to retain their own values while others inherit shared defaults. Documentation and migration guidance explain the breaking behavior, and a regression test covers both preservation and default application. Flow diagram for preserving operation-level OpenAPI fieldsflowchart TD
A[OpenAPI operation] --> B{Field already set?}
B -->|Yes| C[Keep operation value]
B -->|No| D[Apply add_operation_fields default]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #310 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1356 1357 +1
=========================================
+ Hits 1356 1357 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
pushed a commit
to elixir-cloud-aai/cloud-registry
that referenced
this pull request
Oct 19, 2026
Use FOCA options proposed for 0.14.0: policy rules are set via security.access_control.policies instead of being added in code on startup (elixir-cloud-aai/foca#311), and the permission endpoints are routed to their own controller module via x-openapi-router-controller instead of being re-exported from the server module (elixir-cloud-aai/foca#310). Co-Authored-By: Claude Opus 5.5 <[email protected]>
uniqueg
marked this pull request as ready for review
October 19, 2026 21:21
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add_operation_fieldsreplaced fields that operations set themselves. For example, withx-openapi-router-controller: my_app.controllersinadd_operation_fields(the usual way to route all operations), a single operation could not be routed to another controller module via its ownx-openapi-router-controller. This came up in elixir-cloud-aai/cloud-registry#66, which had to re-export controllers from the configured module as a workaround.Fields are now only added to operations that do not set them.
Breaking: fields set by operations are no longer replaced. Noted in the 0.14.0 migration guide; docstrings and the API configuration docs are updated.
Verification
test_add_operation_fields_kept(merges an addition setting the controller of one operation): fails before, passes after.pytest: all pass except the 7 tests markedmongodb, which need a live MongoDB (CI runs them).ruff check,ruff format --check,mypy foca,mkdocs build --strict: pass.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Preserve fields defined by individual operations when applying shared operation-field defaults.
Bug Fixes:
Documentation:
Tests: