You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(core): allow validation report multi-write based on context keys (#34927)
### Reason for this change
It would be helpful to have more options around how the validation report is output. Currently the pretty print and JSON formatted file options are mutually exclusive. This pull request allows both to be used.
The primary driver is to allow users to see their report results in a human-readable format while also having an output artifact that can be consumed by other CI/CD tools.
### Description of changes
It is now possible to print multiple validation report formats. I added a new context key `@aws-cdk/core:validationReportPrettyPrint` boolean that prints the validation report to the console when `true`. I have made this value `true` by default so that users today maintain the same behavior they expect. Setting the existing `@aws-cdk/core:validationReportJson` key still results in only JSON formatted output. Users may now select both options by enabling both keys.
Rather than a pretty print context key, I considered implementing a `@aws-cdk/core:validationReportBoth` key but this seemed to assume there would not be another format option added. It would allow the JSON format key to also keep its current behavior but the tradeoff of both report types appearing for those who only provide the JSON key seemed like a reasonable trade for keeping the report formats open for additional options in the future.
### Describe any new or updated permissions being added
N/A
### Description of how you validated changes
I have added unit tests that validate my changes.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
### EDIT
Following review suggestions the logic has been updated such that:
- Default: pretty print only
- Enable JSON format context key: JSON only
- Enable pretty print context key: pretty print only
- Enable both keys: both formats
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
0 commit comments