How can I let a null values pass in a sam template if it is in an API Gateway DefinitionBody as a response example

Viewed 397

I have an OpenAPI 3.0.1 file and conforming to the standard it contains some examples responses for endpoints. Now since some of the parameters in the response are set to be nullable there are some examples which look as follows:

examples:
  account_not_verified:
    value:
      eamil: 'test@example.com'
      verification: '0'
      name: null

Since the name parameters is set up like this:

name:
    type: string
    nullable: true

I would assume that having a null value in the example response is valid by the open api standard. When I put this into the Swagger Editor is does not show any errors or warnings. But as soon as I include the OpenAPI file into my sam template to be used to configure an HTTP API Gateway like so:

ApiGateway:
  Type: AWS::Serverless::HttpApi
  Properties:
    StageName: !Ref Stage
    FailOnWarnings: true
    DefinitionBody:
      Fn::Transform:
        Name: AWS::Include
        Parameters:
          Location: ./oapi.yml

Cloud formation gives me the following error:

[/Resources/ApiGateway/Type/Body/paths/***/content/application/json/examples/ch_account_not_verified/value/name] 'null' values are not allowed in templates

Is there any way to allow this null value to exist in the example response or do I have to use some different method to indicate the null value in the example?

0 Answers
Related