tsoa icon indicating copy to clipboard operation
tsoa copied to clipboard

Provide name of referencing interface or method when emitting "Object use" warning

Open Flamenco opened this issue 3 years ago • 1 comments

Sorting

  • I'm submitting a ...

    • [ ] bug report
    • [x] feature request
    • [ ] support request

Expected Behavior

I expect the warning message to include the interface or method name that included the culprit.

In this case, it was a method. It took some time to track it down.

 async patchUserMetadata(@Body() body: object, @Path() id: Id) {

Current Behavior

This is what is emitted:

backend_1        | The type Object is discouraged. Please consider using an interface such as:
backend_1        |           export interface IStringToStringDictionary {
backend_1        |             [key: string]: string;
backend_1        |           }
backend_1        |           // or
backend_1        |           export interface IRecordOfAny {
backend_1        |             [key: string]: any;
backend_1        |           }

Flamenco avatar Jun 02 '21 13:06 Flamenco

@WoH I think I have an idea of how to fix this. The problem is that the warning that is displayed will be displayed only if the environment is not a testing environment. https://github.com/lukeautry/tsoa/blob/6d14c1cae2044b12f66bcfcd5423bb2c93589e2c/packages/cli/src/swagger/specGenerator.ts#L139-L150 Should anything be done about that, or can I just simply submit a patch by changing the message displayed to include the culprit without providing tests?

pauliyobo avatar Sep 02 '21 14:09 pauliyobo