moleculer-web icon indicating copy to clipboard operation
moleculer-web copied to clipboard

Route-level `mergeParams` doesn't exist for auto aliases

Open ggondim opened this issue 1 year ago • 1 comments

The mergeParams feature exists at the route-level when declared directly in the API Gateway. However, Auto-alias does not have this feature at the route-level.

At present, auto-alias only supports fullPath, basePath, path and method.

Aliases should have consistent features, whether they are declared in the gateway service or as auto-aliases.

This inconsistency directly affects the ecosystem of modules and plugins, both official and third-party. They are hindered in their ability to set route-level options in services.

For instance, moleculer-db (an official module) has already indicated its lack of support for a global mergeParams: false setting in the API Gateway (Issue #83). Should developers really be mandated to use mergeParams: true when working with moleculer-db?

To cite another case, I'm developing a third-party module named moleculer-mongobubble. It's a mixin that generates actions with auto-aliases, similar to moleculer-db. Due to this issue, it cannot determine if developers have set the mergeParams flag to true or false. This forces me to add extra conditionals to discern how parameters were passed to each action.

ggondim avatar Sep 05 '23 22:09 ggondim

so an action level mergeParams could solve this problem, right? I will check whether it can be implemented or not.

icebob avatar Sep 07 '23 18:09 icebob