feat(cli): cdk validate command (behind --unstable flag)#1527
Open
kaizencc wants to merge 11 commits into
Open
feat(cli): cdk validate command (behind --unstable flag)#1527kaizencc wants to merge 11 commits into
cdk validate command (behind --unstable flag)#1527kaizencc wants to merge 11 commits into
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
72951bb to
152e026
Compare
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…lidate Instead of redefining the policy validation report types locally, import them from @aws-cdk/cloud-assembly-schema (added in PR #1515). This removes ~130 lines of duplicate type definitions and simplifies the validate method to a typed cast instead of manual field mapping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Handle malformed report: throw ToolkitError if pluginReports is missing or not an array - Test constructStack (ConstructTraceJson): add recursive trace to fixture and assert nested id/construct/location fields - Assert IO message data payload contains full ValidateResult - Test missing title field gracefully results in undefined Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace 'as const' with explicit PolicyValidationReportStatus type annotation - Extract 'policy-validation-report.json' to a file-level constant Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lidate - Overhaul validate-formatting: severity+description bold with color (red=fatal, orange=error, yellow=warning/info/custom), construct path bold, source location extracted to file:line:col format - Support info and custom severity levels with proper sort ordering - Use info-level IO to avoid CLI wrapping output in red - Set @aws-cdk/core:validationReportOnly context before synth - Add VALIDATE to Command enum and regenerate CLI parser files - Add integ test fixture (SecurityPlugin + Construct Annotations + ack) - Add 3 integ tests (violations, passes, acknowledge suppresses) - Add static multi-plugin fixture for formatter testing
06c9381 to
4c04289
Compare
Update the validate command implementation and tests to use the actual types from the cloud-assembly-schema package (PR #1515): - PolicyValidationReportStatus → PolicyValidationReportConclusion - status → conclusion - summary.pluginName → pluginName - fix → suggestedFix - constructStack → stackTraces - resourceLogicalId/templatePath/locations → cloudFormationResource - Use Manifest.loadValidationReport for schema-validated loading - Update all test fixtures to match the validation report schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires up
cdk validateas a CLI command behind the--unstable=validatefeature flag. The command synthesizes the app, reads the policy validation report JSON from the cloud assembly, and renders results using a new formatter.Changes
validatecommand definition withSTACKSvariadic argcase validatehandler, sets@aws-cdk/core:validationReportOnlycontext to suppress synthesis-time reporting (depends on aws-cdk#37909)validate()method that delegates tothis.toolkit.validate()validatetoUnstableFeature, useshostMessageFromValidationhelperDependencies
@aws-cdk/core:validationReportOnlycontext keyBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license