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

fix(apigateway): move url property to RestApiBase #27742

Merged

Conversation

hariprakash-j
Copy link
Contributor

Moved the url property from RestApi class to the RestApiBase to have the url property on all derived class. This will fix the problem mentioned in the issue where SpecRestApi does not work with the RestApiOrigin construct.

PS. I could not perform the integration tests as the free tier on my personal account expired.

Closes #27501.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 labels Oct 29, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team October 29, 2023 10:16
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@hariprakash-j
Copy link
Contributor Author

Exemption Request

I just moved the property to the base class, I am not sure what tests are required for this. If there is any thing that I can do for this please let me know.

@aws-cdk-automation aws-cdk-automation added pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. pr/needs-maintainer-review This PR needs a review from a Core Team Member labels Oct 29, 2023
@sumupitchayan
Copy link
Contributor

@hariprakash-j Can you add a unit test for your use case?

Additionally, this needs to have an Integ test for the use case you are trying to solve. I can run the integ test if you write it

@hariprakash-j
Copy link
Contributor Author

@sumupitchayan Thanks for the help with the integration tests and I added the integ tests and the unit tests.

@aws-cdk-automation aws-cdk-automation dismissed their stale review October 31, 2023 16:26

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@hariprakash-j
Copy link
Contributor Author

@sumupitchayan I was able to find a aws account with free tier to run the integ tests and generate the snapshots

@@ -35,7 +35,7 @@ export interface RestApiOriginProps extends cloudfront.OriginProps {
*/
export class RestApiOrigin extends cloudfront.OriginBase {

constructor(restApi: apigateway.RestApi, private readonly props: RestApiOriginProps = {}) {
constructor(restApi: apigateway.RestApiBase, private readonly props: RestApiOriginProps = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@hariprakash-j Can you explain the reasoning behind this change and why it is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sumupitchayan Earlier the url property was only in the class RestApi and the classes that extended it. The SpecRestApi class did not inherit from this class as it extended RestApiBase and thus caused an error when one tried to use it a SpecRestApi with RestApiOrigin . Now, however you can use any class that extends the RestApiBase since i have moved the url property to the to this class. This will fix the the issue that was outlined in the issue and prevent this from happening in any new RestApi construct as they will all inherit from the RestApiBase or a class that extends it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sumupitchayan , let me know if I'm missing something here

'/',
{ Ref: 'apiDeploymentStageprod896C8101' },
'/']],
['',
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these new space changes? If this was a formatting change can you remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sumupitchayan , changing it back shows a eslint error. it seems they did not indent this well earlier.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sumupitchayan , do you think i should do something here ?

sumupitchayan
sumupitchayan previously approved these changes Nov 30, 2023
Copy link
Contributor

mergify bot commented Nov 30, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 30, 2023
Copy link
Contributor

mergify bot commented Nov 30, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed sumupitchayan’s stale review December 4, 2023 23:08

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 4, 2023
vinayak-kukreja
vinayak-kukreja previously approved these changes Dec 5, 2023
Copy link
Contributor

mergify bot commented Dec 5, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 5, 2023
@vinayak-kukreja
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Dec 5, 2023

update

✅ Branch has been successfully updated

@mergify mergify bot dismissed vinayak-kukreja’s stale review December 5, 2023 00:43

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 5, 2023
@vinayak-kukreja
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Dec 5, 2023

update

✅ Branch has been successfully updated

Copy link
Contributor

mergify bot commented Dec 5, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 5, 2023
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: bad5b43
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit b23ee1b into aws:main Dec 5, 2023
12 checks passed
Copy link
Contributor

mergify bot commented Dec 5, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

chenjane-dev pushed a commit to chenjane-dev/aws-cdk that referenced this pull request Dec 5, 2023
Moved the url property from RestApi class to the RestApiBase to have the url property on all derived class. This will fix the problem mentioned in the issue where SpecRestApi does not work with the RestApiOrigin construct.

PS. I could not perform the integration tests as the free tier on my personal account expired.

Closes aws#27501.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloudfront Origin does not support SpecRestApi
4 participants