How to add a request validator in a AWS SAM template for AWS::Serverless::Api?

后端 未结 1 403
花落未央
花落未央 2021-02-09 23:25

I\'m trying to use AWS SAM to link a request validator resource to a serverless API in a SAM template. I have created the request validator and referenced the API in its RestApi

相关标签:
1条回答
  • 2021-02-09 23:44

    I searched through source code for api transformation functions and there is no way how to append request validation. SAM transform AWS::Serverless::Api to inline body swagger/openapi definition but has nothing for x-amazon-apigateway-request-validator. I don't understand why there is way to define model in lambda event when it only append schema section in api method

    "paths": {
      "/post": {
        "post": {
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/user"
                }
              }
            }, 
            "required": true
          }, 
    

    maybe add feature request in SAM github

    0 讨论(0)
提交回复
热议问题