openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

[feature] Allow partial custom API view modules

Open nemesifier opened this issue 3 months ago • 3 comments

Is your feature request related to a problem? Please describe.

This feature request is inspired by the work done in openwisp-users issue #553 and its reference implementation in PR #554.

The Config, Connection, and PKI API URL helpers require custom views modules to define every callback. An extension that customizes one API view must duplicate the remaining callbacks, and new upstream routes can break the custom module during URL configuration.

Describe the solution you'd like

Allow config.api.urls.get_api_urls(), connection.api.urls.get_api_urls(), and pki.api.urls.get_pki_api_urls() to use the matching callback from a supplied module when it exists and fall back to their standard views otherwise. The helpers should preserve current paths, names, namespaces, and default behavior.

Add focused regression coverage for supplied callbacks and omitted-callback fallbacks across all three API groups, then document partial API view overrides in the extension guide.

Describe alternatives you've considered

Custom applications can continue duplicating every callback alias from the standard modules, but that creates unnecessary boilerplate and couples them to the complete upstream callback sets.

Additional context

This would also benefit projects, such as Firmware Upgrader, that customize Controller connection API views.

nemesifier avatar Aug 08 '26 00:08 nemesifier

Should we also extend this feature for get_geo_urls()?

CodingWithSaksham avatar Aug 28 '26 18:08 CodingWithSaksham

Should we also extend this feature for get_geo_urls()?

Yes, it should be consistent across the entire codebase as much as possible.

nemesifier avatar Sep 01 '26 16:09 nemesifier

This issue has been automatically assigned to @CodingWithSaksham who opened PR #1472 to address it. 🎯

openwisp-companion avatar Sep 01 '26 18:09 openwisp-companion