You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: plugin listing breaks with app router controller #515
The plugin listing API spec (foca/plugins/api.yaml) uses absolute operationIds (foca.plugins.api.listPlugins, foca.plugins.api.getPlugin) and sets no x-openapi-router-controller of its own.
The docs (docs/plugins.md, "serving the listing") tell apps to put SPEC_PATH in front of their own spec files. FOCA merges all spec files first and then applies add_operation_fields with setdefault, so an app that sets x-openapi-router-controller through add_operation_fields also sets its controller on the plugin operations. Connexion then resolves <controller>.foca.plugins.api.listPlugins and the import fails.
Scenario
Take examples/petstore-access-control, add Foca(..., gateway=GatewayApp(api="tes")) and the documented spec.path = [Path(SPEC_PATH), *files], and run it under gunicorn: Failed to add operation for GET /plugins, then ModuleNotFoundError: No module named 'controllers.foca', and the worker fails to boot. With resolver_error: 501, the app starts but GET /plugins returns 501.
Affected: proTES, cloud-registry and both petstore examples use this pattern.
Fix
Set x-openapi-router-controller: foca.plugins.api on both operations in api.yaml and use relative operationIds (listPlugins, getPlugin).
Add a regression test that merges SPEC_PATH into a spec with add_operation_fields: {x-openapi-router-controller: ...}.
Found in the v0.18.0 pre-release review (finding 1).
Activity