chore(assertions): snippets in readme are now rosetta compilable#16801
chore(assertions): snippets in readme are now rosetta compilable#16801mergify[bot] merged 8 commits intomasterfrom
Conversation
|
The README in Python after translation looks like so - AssertionsFunctions for writing test asserting against CDK applications, with focus on CloudFormation templates. The To create Alternatively, assertions can be run on an existing CloudFormation template - Full Template MatchThe simplest assertion would be to assert that the template matches a given By default, the Snapshot testing is a common technique to store a snapshot of the output and The See Snapshot Testing in Jest and Snapshot Counting ResourcesThis module allows asserting the number of resources of a specific type found Resource Matching & RetrievalBeyond resource counting, the module also allows asserting that a resource with The following code asserts that the Alternatively, if you would like to assert the entire resource definition, you Beyond assertions, the module provides APIs to retrieve matching resources. By default, the Output and Mapping sectionsThe module allows you to assert that the CloudFormation template contains an Output If you want to match against all Outputs in the template, use
The APIs Special MatchersThe expectation provided to the They are available as part of the Object MatchersThe The Presence and AbsenceThe The This matcher can be combined with any of the other matchers. Array MatchersThe Note: The list of items in the pattern array should be in order as they appear in the Alternatively, the Not MatcherThe not matcher inverts the search pattern and matches all patterns in the path that does Serialized JSONOften, we find that some CloudFormation Resource types declare properties as a string, The Capturing ValuesThis matcher APIs documented above allow capturing values in the matching entry |
| assert.hasResourceProperties('Foo::Bar', { | ||
| const unexpected = { | ||
| Fred: Match.objectLike({ | ||
| Brew: 'Coffee', |
There was a problem hiding this comment.
Why does this evaluate to Brew="Coffee" in the Python translation? I feel like it should be a :.
There was a problem hiding this comment.
Yeah, it's cuz the translator is misinterpreting the types. aws/jsii#3029
I'll fix them up.
There was a problem hiding this comment.
Fixed but not happy with the output.
@rix0rrr - I've had to cast many of these structs to Record<string, any> to get the transcoding to work correctly.
Any suggestions on anything I missed, or maybe a cleaner way to do this? This looks a bit ugly on the typescript readme (can even be confusing for customers looking for copy-pasta code snippets)
There was a problem hiding this comment.
Yeah, don't do that. It's better to fix it upstream.
There was a problem hiding this comment.
Overall this will be sooo helpful if we can get the Python translation to a usable state. Another thing you'll have to change (even though theres no merge conflict) is that now that absentProperty() -> absent() is merged, the examples with absentProperty() must be renamed as well.
(I meant to start a review and instead clicked "add single comment", so sorry for the weird formatting.)
f59362d to
1bd74a7
Compare
There was a problem hiding this comment.
Not sure if this PR changes this already but the current docs for C# say to use new Struct {... everywhere and that is incorrect. I did a lot of research and found that new Dictionary<string,object>{... works. Not sure if that is an intuitive solution for C# devs, as I am not one. I tried explaining myself in depth in my csharp lambda-cron example here but I fear I did not do an adequate job. Happy to explain my concerns synchronously if they are convoluted in writing.
This reverts commit 64b02d5.
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This is because the rosetta samples are not compilable. It should get fixed in this PR. |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…#16801) Rosetta automatic snippet translation is doing a poor job of snippet translation. This is mainly because the snippets are not compilable. Update snippets to make them compilable and translate correctly. Additionally, make the rosetta compilation strict and run during the build step. There are still a few more translation errors, but these are arising from bugs in rosetta. aws/jsii#3026 aws/jsii#3029 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Rosetta automatic snippet translation is doing a poor
job of snippet translation. This is mainly because the
snippets are not compilable.
Update snippets to make them compilable and translate
correctly.
Additionally, make the rosetta compilation strict and run
during the build step.
There are still a few more translation errors, but these are
arising from bugs in rosetta.
aws/jsii#3026
aws/jsii#3029
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license