Skip to content

fix(E3001): allow a string resource-level Description - #4922

Merged
kddejong merged 1 commit into
aws-cloudformation:mainfrom
blacksoxx:e3001-resource-description
Oct 26, 2026
Merged

kddejong merged 1 commit into
aws-cloudformation:mainfrom
blacksoxx:e3001-resource-description

Conversation

@blacksoxx

Copy link
Copy Markdown
Contributor

Issue #, if available: #4766

Description of changes:

other/resources/configuration.json did not list Description, so a string resource-level Description reported E3001 Additional properties are not allowed ('Description' was unexpected). CloudFormation accepts the key and type-checks it, and aws-cdk-lib writes it from cfnOptions.description.

The schema now has Description as a string. A string value passes; any other value still reports E3001, now as is not of type 'string' on the Description path, which matches the Every Description member must be a string error CloudFormation returns.

Tests: test_resource_level_description covers the two templates from the issue and a non-string value. The existing W3001 and E3001 tests used Description as their stray key, so they now use other keys (Handler, Name, Comment, Timeout) and keep their intent. On AWS::Serverless::* resources a string Description is accepted as well and no longer reports W3001; the SAM transform drops it like any other attribute outside its five supported ones, so the warning can be kept for SAM resources with a type-conditional in the schema if you prefer that.

Verified on the issue's template: no finding for the two string descriptions, E3001 ['resource level description'] is not of type 'string' for a list value. pytest for the full unit suite passes locally.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

CloudFormation accepts a string Description on any resource and aws-cdk-lib writes it from cfnOptions.description, but other/resources/configuration.json did not list it, so E3001 reported it as an unexpected property. Add it as a string so any other value still fails the type check.

Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.68%. Comparing base (f8baa08) to head (fcc6ebe).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4922   +/-   ##
=======================================
  Coverage   94.68%   94.68%           
=======================================
  Files         439      439           
  Lines       16016    16016           
  Branches     3111     3111           
=======================================
  Hits        15165    15165           
  Misses        468      468           
  Partials      383      383           
Flag Coverage Δ
unittests 94.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kddejong
kddejong merged commit f2e3c87 into aws-cloudformation:main Oct 26, 2026
24 of 25 checks passed
kddejong added a commit that referenced this pull request Oct 26, 2026
PR #4922 closed issue #4766 by adding Description to the resource
configuration schema, which also made a resource-level Description on an
AWS::Serverless::* resource silent instead of W3001. That is correct --
CloudFormation accepts, type-checks and discards the attribute on every
resource type, so the discard is not the SAM transform's doing -- but
#4922 made the change by swapping Description out of the existing tests
for other stray keys, so nothing pinned the new behavior.

Add a test asserting AWS::Serverless::Function with a string
resource-level Description produces neither W3001 nor E3001.
@blacksoxx

Copy link
Copy Markdown
Contributor Author

Thanks @kddejong for the quick review and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants