Skip to content

Defining AWS::Serverless::Api without OpenApiVersion should be a warning #4272

@rbu

Description

@rbu

Is this feature request related to a new rule or cfn-lint capabilities?

rules

Describe the feature you'd like to request

Defining a AWS::Serverless::Api will create a Stage stage besides user-defined stages. This bug has been reported in 2017 and solved. However, for backwards-compatibility reasons, it is only solved if an Api resource sets the OpenApiVersion, which is very unobvious.

I would argue that any existing stack that relies on this unexpected behavior can be expected to add a linting exception, and new / existing stacks should fail linting and can use that signal to check if they really intended to have a Stage stage around.

Describe the solution you'd like

Raise a linter warning if AWS::Serverless::Api is defined, but the OpenApiVersion property is unset.

Additional context

The partial fixing of this bug has triggered numerous comments and new bug reports on SAM regarding this behavior, such as aws/serverless-application-model#3447 or aws-cloudformation/cfn-language-discussion#155

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions