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(AWS API Gateway): Allow use of custom authorizer with authorizerId #10384

Merged
merged 3 commits into from Dec 21, 2021

Conversation

darksun
Copy link
Contributor

@darksun darksun commented Dec 16, 2021

Closes: #8769

@codecov
Copy link

codecov bot commented Dec 17, 2021

Codecov Report

Merging #10384 (eeb50b5) into master (41ebc86) will not change coverage.
The diff coverage is n/a.

❗ Current head eeb50b5 differs from pull request most recent head 7f5fba6. Consider uploading reports for the commit 7f5fba6 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10384   +/-   ##
=======================================
  Coverage   85.37%   85.37%           
=======================================
  Files         340      340           
  Lines       14005    14005           
=======================================
  Hits        11957    11957           
  Misses       2048     2048           
Impacted Files Coverage Δ
...ins/aws/package/compile/events/apiGateway/index.js 93.65% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41ebc86...7f5fba6. Read the comment docs.

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

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

Thanks @darksun, I have only one comment related to testing, please let me know what do you think

@@ -235,6 +235,52 @@ describe('#validate()', () => {
expect(() => awsCompileApigEvents.validate()).not.to.throw(Error);
});

it('should throw when using a CUSTOM authorizer without an authorizer id', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

For a long time now we're only accepting new tests written with using runServerless utility and are slowly migrating away from the old approach. Could you please cover it with such tests instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, sorry I had missed that earlier in the test README.

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

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

Looks great, I only have minor remarks, please let me know what do you think

},
},
},
}).then(({ awsNaming: naming, cfTemplate }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use async/await instead of then

@@ -235,6 +235,69 @@ describe('#validate()', () => {
expect(() => awsCompileApigEvents.validate()).not.to.throw(Error);
});

it('should throw when using a CUSTOM authorizer without an authorizer id', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move these two tests into the second describe at the bottom of the file that has only runServerless based tests

@darksun
Copy link
Contributor Author

darksun commented Dec 20, 2021

Rebased with master to get the coverage report to pass.

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

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

Thank you @darksun, well done 👍

@pgrzesik pgrzesik changed the title Allow use of custom authorizer types with authorizerId to pass schema validation feat(AWS API Gateway): Allow use of custom authorizer with authorizerId Dec 21, 2021
@pgrzesik pgrzesik merged commit c0eda27 into serverless:master Dec 21, 2021
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.

Configuration warning when defining authorizer via type=custom and authorizerId
2 participants