fix(): use unique operation id for each endpoint (class_method)#487
Conversation
|
|
||
| private getOperationId(instance: object, method: Function): string { | ||
| if (instance.constructor) { | ||
| return `${instance.constructor.name}_${method.name}`; |
There was a problem hiding this comment.
As much as I need this fix too, wouldn't it be better if an invalid character in a JS identifier is used as a separator, to prevent creating unintentional clashes?
Like "-" for example? Generators should be smart enough to escape that into the target language, and doc generators can generate URLs without requiring URL escaping even.
Example of a clash:
ModuleController_UsingThisCase controller
DoAction method
vs.
ModuleController controller
UsingThisCase_DoAction method
sure, chances of such collisions happening in the same code base are minimal, at best, given the popularity of linting tools, but still. "-" is not valid in a JS identifier, so one can't possibly cause a clash with the defaults alone.
There was a problem hiding this comment.
I'm not sure if we should protect ourselves against code that shouldn't appear in any codebase since it simply violates too many rules (+ probability of having such a naming clash can be brought down to 0)
|
This is a breaking change. You should give an option to disable it. Some of us have to rewrite hundreds of calls now. I have to downgrade until then sadly |
Make the behavior change for operation names that was introduced in nestjs#487 configurable
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Operation ID == method name
Issue Number: #482
What is the new behavior?
Operation ID == ClassName_MethodName
Does this PR introduce a breaking change?
Other information