ISIL-ESTE / Student-Workflow-Organizer

The Workflow Organizer website helps students to organize their academic workload through features such as a dashboard, timeline, reminders, collaboration tools, resource library, progress tracking, and analytics. It also allows users to share and summarize courses and seek project help.
MIT License
47 stars 21 forks source link

TSOA - fix multiple response message with the same status code #158

Closed bellaabdelouahab closed 4 months ago

bellaabdelouahab commented 1 year ago

what do you think about this :

file --> backend-app\node_modules\@tsoa\cli\dist\cli.js

    buildOperation(controllerName, method, defaultProduces) {
        const swaggerResponses = {};
        method.responses.forEach((res) => {
            if (swaggerResponses[res.name]) {
                swaggerResponses[res.name].description += ` \n - ${res.description}`;
            } else {
                swaggerResponses[res.name] = {
                    description:  '- '+ res.description,
                };
            }

i have modified tsoa package to achive the aproach of multiple response with same status code :

    @Response(400, 'Please provide email and password')
    @Response(400, 'Invalid email or password')
    @Response(400, 'You haven\'t set a password yet. Please login with GitHub and set a password from your profile page.')
    public async login(
        @Request() _req: Express.Request,
        @Res() res: TsoaResponse<200, { accessToken: string; user: any }>,
        @Body() body?: { email?: string; password?: string }
    ): Promise<void> {}

it is working but the problem is that any one who installs the project he will need to modify the package ! what do you think ? can you find a better aproach ? or should we just keep it as it was

@muttaqin1

muttaqin1 commented 1 year ago

You can fork the tsoa repo. Make the necessary changes in your fork. Then in your terminal paste this command.

npm i user_name/repo_name

The modified version of the package will be installed. We can pull new changes from the original repo by syncing the fork then update the package using npm

npm update user_nme/repo_name
bellaabdelouahab commented 1 year ago

Wait ! I don't have to create a package or build it or what ? And are you saying to perform npm install from GitHub even though it is not registered in npm ? @muttaqin1

muttaqin1 commented 1 year ago

Wait ! I don't have to create a package or build it or what ? And are you saying to perform npm install from GitHub even though it is not registered in npm ? @muttaqin1

Yeah, this should work. Can you try this at once? Because npm lib's are hosted on GitHub.

muttaqin1 commented 1 year ago

You dont have to register it on npm. @bellaabdelouahab

bellaabdelouahab commented 1 year ago

okay i will test it

muttaqin1 commented 12 months ago

Any updates? @bellaabdelouahab

bellaabdelouahab commented 11 months ago

I found many approaches, but none of them worked. If you have any idea, then please suggest it; other than that, We will just leave it as an issue for an other time @muttaqin1

muttaqin1 commented 11 months ago

We can leave it for now. I will try to resolve this issue later. @bellaabdelouahab

bellaabdelouahab commented 4 months ago

@muttaqin1 found anything ?

muttaqin1 commented 4 months ago

@muttaqin1 found anything ?

No bro. I thought this will work. But as you have said that is not working now we can create a issue in tsoa github repo and wait or leave it as it is 😥😥😥

bellaabdelouahab commented 4 months ago

For now we leave the old approach @muttaqin1 I'll colse this as not planned