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
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
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
Refand a value instead). We lint the translated template so I need to find a way to handle that.