-
Notifications
You must be signed in to change notification settings - Fork 4.1k
APIGateway: Cannot create Resource with colon in pathPart #22477
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
Labels
@aws-cdk/aws-apigateway
Related to Amazon API Gateway
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
good first issue
Related to contributions. See CONTRIBUTING.md
p2
Comments
Merged
4 tasks
mergify bot
pushed a commit
that referenced
this issue
Oct 19, 2022
… resources with colon (#22531) This PR adjusts the validation rules for path parts in resources created using the APIGateway library to allow the use of colons in pathParts, as requested in #22477. This enables the creation of resources with paths such as `events:batch` (from the reproduction steps in the related issue). An existing resource unit test (`'url for a resource'`) has been updated to ensure that a colon in a pathPart does not throw an error and properly reflects in the output of `RestApi.urlForPath`. The integration test `integ.restapi` has also been updated, wherein the `appliances` resource now has a path of `appliances:all` instead of `appliances`. If this is the wrong place to test the fix, I will gladly create a new resource to test on, or a new test altogether. Closes #22477. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
mrgrain
pushed a commit
to mrgrain/aws-cdk
that referenced
this issue
Oct 24, 2022
… resources with colon (aws#22531) This PR adjusts the validation rules for path parts in resources created using the APIGateway library to allow the use of colons in pathParts, as requested in aws#22477. This enables the creation of resources with paths such as `events:batch` (from the reproduction steps in the related issue). An existing resource unit test (`'url for a resource'`) has been updated to ensure that a colon in a pathPart does not throw an error and properly reflects in the output of `RestApi.urlForPath`. The integration test `integ.restapi` has also been updated, wherein the `appliances` resource now has a path of `appliances:all` instead of `appliances`. If this is the wrong place to test the fix, I will gladly create a new resource to test on, or a new test altogether. Closes aws#22477. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *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
@aws-cdk/aws-apigateway
Related to Amazon API Gateway
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
good first issue
Related to contributions. See CONTRIBUTING.md
p2
Describe the bug
Cannot create Resource with a colon in the pathPart. This error is thrown:
Error: Resource's path part only allow [a-zA-Z0-9._-], an optional trailing '+' and curly braces at the beginning and the end: events:batch
.Expected Behavior
I expect to successfully deploy this since this works in both the L1 construct and the console.
Current Behavior
This error is thrown during synth:
Error: Resource's path part only allow [a-zA-Z0-9._-], an optional trailing '+' and curly braces at the beginning and the end: events:batch
.Reproduction Steps
Possible Solution
Change this to allow colons:
aws-cdk/packages/@aws-cdk/aws-apigateway/lib/resource.ts
Line 555 in af1fb7c
Additional Information/Context
A workaround is
CDK CLI Version
2.45.0
Framework Version
No response
Node.js Version
16.16.0
OS
OSX
Language
Typescript, Python
Language Version
Python (3.10.4)
Other information
No response
The text was updated successfully, but these errors were encountered: