Skip to content

@praneetap praneetap released this Jul 26, 2019 · 8 commits to master since this release

SAM v1.13.0 Release: OpenApi 3 Support and Request Models Support

OpenApi 3.0 support and Stage "stage" fix

We have now added support for OpenApi 3.0 in SAM. This is an opt-in feature that can be enabled by using the OpenApiVersion property for an AWS::Serverless::Api. This property is supported at both the resource and global levels of the template.

Globals:
  Api:
    OpenApiVersion: '3.0.1'

Resources:
  ImplicitApiFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: s3://sam-demo-bucket/member_portal.zip
      Handler: index.gethtml
      Runtime: nodejs8.10
      Events:
        GetHtml:
          Type: Api
          Properties:
            Path: /
            Method: get

If you opt into this flag, SAM also fixes the issue where a stage named "stage" was created by default. #191

API Request Models Support

This feature adds support for listing Models in the Api resource and defining a model to be used in the Api event source. Previously, the only way to do this was to manually write the swagger file. This now makes it much simpler to define the models, and special callout to community member @beck3905 for adding this feature.

Resources:
  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: prod
      Models:
        User:
          type: object
          required:
            - grant_type
            - username
            - password
          properties:
            grant_type:
              type: string
            username:
              type: string
            password:
              type: string
  MyLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: nodejs6.10
      CodeUri: src/
      Events:
        GetApi:
          Type: Api
          Properties:
            Path: /post
            Method: POST
            RestApiId:
              Ref: MyApi
            RequestModel:
              Model: User
              Required: true

Change Log:

  1. (#932)(#949)(#990) OpenApi 3.0 support and stage stage bug fix
  2. (#948) API Request Models Support by @beck3905
  3. (#958) Fix CORS options method when DefaultAuthorizer is used
  4. (#954) Fix API Binary Media Types update issue
  5. (#946)(#973) Bug fixes
  6. (#962)(#961)(#960)(#963)(#979) version bumps in dependencies
  7. (#950)(#968)(#982) Additions to docs and examples
Assets 2
You can’t perform that action at this time.