Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Invalid parameterized type resolution for properties containing nested aggregate types (i.e. Map<Json> & List<Json>) #207

Closed
RazzM13 opened this issue Oct 31, 2018 · 2 comments

Comments

@RazzM13
Copy link
Contributor

RazzM13 commented Oct 31, 2018

Thanks to @aap69, we've discovered a problem with cfn-lint's type inference of SAM properties that may contain as values nested aggregate types (i.e. JSON or any other aggregate structure within a Map or a List).

Steps to reproduce:

  1. Save the following problematic sample to a file (e.g. sam_20161031_issue_new.yaml):
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  somethingBeautiful:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: somethingCool
      Handler: somethingAwesome
      Policies:
        -
          Statement:
            -
              Effect: "Allow"
              Action: "*"
              Resource: "*"
      Runtime: someRuntime
      Timeout: 300
  1. Attempt to validate the file containing the sample template:
0 infos
0 warn
1 crit
Resource: Resources > somethingBeautiful > Properties > Policies
Message: Expecting an object, got []
Documentation: https://github.com/awslabs/serverless-application-model/blob/develop/versions/2016-10-31.md#awsserverlessfunction
  1. Consult the output of the previous command.

Expected result: The validation should have passed.
Actual result: The validation failed.

@RazzM13
Copy link
Contributor Author

RazzM13 commented Oct 31, 2018

Hey @martysweet, please feel free to have a look over this and let me know if anything is missing or otherwise incorrect.

RazzM13 added a commit to RazzM13/cfn-lint that referenced this issue Nov 2, 2018
… for functions relating to the former as well as a regression test for issue martysweet#207.
martysweet pushed a commit that referenced this issue Nov 15, 2018
… nested aggregate types. (#208)

* Fixed type inference of properties containing unresolved intrinsics as well as nested aggregate types.

* Updated SAM CFN specification file.

* Normalized naming of aggregate type constant (i.e. `awsComplexTypes` -> `awsAggregateTypes`) and verification function (i.e. `isComplexType` -> `isAggregateType`).

* Fixed data corruption during type inference, added nullipotency tests for functions relating to the former as well as a regression test for issue #207.

* Update CHANGELOG.md
@martysweet
Copy link
Owner

Thanks @RazzM13, this is now in v1.9.2 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants