Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simplify done() function #647

Merged
merged 5 commits into from
Dec 20, 2023

Conversation

ankur0904
Copy link
Contributor

Description

  • This PR simplified the done() function to take only one input bool as input.
  • The related documentation is also changed.

Related issue(s)
Resolves #596

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@ankur0904 ankur0904 changed the title Simplify done() function feat: simplify done() function Dec 13, 2023
@@ -50,11 +50,11 @@ class HttpAdapter extends Adapter {
})
return {
promise,
done: (val: boolean, code = 401, message = 'Unauthorized') => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do the same for the WebSocket adapter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KhudaDad414 Sure :)

@KhudaDad414
Copy link
Member

@ankur0904 do you need some help with this?

@ankur0904
Copy link
Contributor Author

@KhudaDad414 The current code don't have code = 401, message = 'Unauthorized' these arguments where the changes is supposed to done.

Please tell me if I am missing something.

class HttpAdapter extends Adapter {
    ...
     // code of done function
      return {
        promise,
        done: (val: boolean) => {
          if (val) {
            resolveFunc(true)
          } else {
            rejectFunc({ code: 401, message: 'Unauthorized' })
          }
      }
   }
   ...
}

@KhudaDad414
Copy link
Member

@ankur0904 ws adapter has the same code:

return function done(val: boolean, code = 401, message = 'Unauthorized') {

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ankur0904
Copy link
Contributor Author

Sorry, @KhudaDad414 I missed the ws folder. I made the commit in which the required changes are reflected. Please have a look.

@KhudaDad414
Copy link
Member

@afzal442 this change will touch the docs. do you want to have look?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7265431969

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 72.884%

Totals Coverage Status
Change from base Build 7264150988: 0.0%
Covered Lines: 388
Relevant Lines: 483

💛 - Coveralls

@afzal442
Copy link
Contributor

sure! I do. and thanks for reminder.

@afzal442
Copy link
Contributor

afzal442 commented Dec 20, 2023

So now done() func takes in boolean value only. LGTM!

Copy link
Member

@KhudaDad414 KhudaDad414 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@afzal442
Copy link
Contributor

Thanks @ankur0904 for your contrib. 💪🏻

@afzal442
Copy link
Contributor

/rtm

@asyncapi-bot asyncapi-bot merged commit c6fade7 into asyncapi:master Dec 20, 2023
11 checks passed
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.33.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ankur0904
Copy link
Contributor Author

Thanks @KhudaDad414 @afzal442 for merging the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify done() Function to Only Accept Boolean for Authentication Status
5 participants