Cfn-python-lint: W2001 reported when parameter used inside DefinitionBody

Created on 2 May 2019  路  2Comments  路  Source: aws-cloudformation/cfn-python-lint

cfn-lint version: 0.19.1

Error W2001 that parameter is not used thrown when the parameter exists inside only inside the DefinitionBody in a OpenAPI spec.

Example template that reproduces 3 errors that parameters are not used when they exists only inside the DefinitionBody.

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'

Parameters:
  ECSStack:
    Type: String
  AppStack:
    Type: String
  CognitoStackName:
    Type: String

Resources:
  MyAPI:
    Type: AWS::Serverless::Api
    Properties:
      StageName: dev
      EndpointConfiguration: EDGE
      DefinitionBody:        
        openapi: 3.0.1
        paths:
          /:
            get:
              x-amazon-apigateway-integration:
                connectionId: 
                  Fn::ImportValue: 
                    !Sub ${ECSStack}-VPCLink
                uri: 
                  Fn::Sub:
                    - http://${EndpointUri}/
                    - EndpointUri: !ImportValue
                        Fn::Sub: ${AppStack}-PrivateDNSEndpoint

          securitySchemes:
            cognitoAuth:
              type: apiKey
              name: Authorization
              in: header
              x-amazon-apigateway-authtype: cognito_user_pools
              x-amazon-apigateway-authorizer:
                type: cognito_user_pools
                providerARNs: 
                  - Fn::ImportValue: !Sub ${CognitoStackName}-Arn

Template above results in the following failure:

W2001 Parameter ECSStack not used.
min_api.yml:5:3

W2001 Parameter AppStack not used.
min_api.yml:7:3

W2001 Parameter CognitoStackName not used.
min_api.yml:9:3
bug

Most helpful comment

Yea going to be working on that shortly. The SAM translator plugs in values for those parameters, which results in them no longer being there (Removal of the Ref and a value instead). We lint the translated template so I need to find a way to handle that.

All 2 comments

Yea going to be working on that shortly. The SAM translator plugs in values for those parameters, which results in them no longer being there (Removal of the Ref and a value instead). We lint the translated template so I need to find a way to handle that.

Fixed with release v0.20.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adamchainz picture adamchainz  路  5Comments

adamchainz picture adamchainz  路  4Comments

AlessandroLorenzi picture AlessandroLorenzi  路  3Comments

kddejong picture kddejong  路  3Comments

miparnisari picture miparnisari  路  3Comments