serverless-reqvalidator-plugin
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "serverless-reqvalidator-plugin", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Serverless plugin for setting request validation", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
109
README.md
@@ -72,3 +72,3 @@ # serverless-reqvalidator-plugin | ||
resources: | ||
Resource: | ||
Resources: | ||
xMyRequestValidator: | ||
@@ -105,2 +105,107 @@ Type: "AWS::ApiGateway::RequestValidator" | ||
Fn::ImportValue: 'myReqValidator' | ||
``` | ||
``` | ||
### Full example | ||
``` | ||
service: | ||
name: my-service | ||
plugins: | ||
- serverless-webpack | ||
- serverless-reqvalidator-plugin | ||
- serverless-aws-documentation | ||
provider: | ||
name: aws | ||
runtime: nodejs6.10 | ||
region: eu-west-2 | ||
environment: | ||
NODE_ENV: ${self:provider.stage} | ||
custom: | ||
documentation: | ||
api: | ||
info: | ||
version: '1.0.0' | ||
title: My API | ||
description: This is my API | ||
tags: | ||
- | ||
name: User | ||
description: User Management | ||
models: | ||
- name: MessageResponse | ||
contentType: "application/json" | ||
schema: | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
- name: RegisterUserRequest | ||
contentType: "application/json" | ||
schema: | ||
required: | ||
- password | ||
properties: | ||
email: | ||
type: string | ||
password: | ||
type: string | ||
- name: RegisterUserResponse | ||
contentType: "application/json" | ||
schema: | ||
type: object | ||
properties: | ||
result: | ||
type: string | ||
- name: 400JsonResponse | ||
contentType: "application/json" | ||
schema: | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
statusCode: | ||
type: number | ||
commonModelSchemaFragments: | ||
MethodResponse400Json: | ||
statusCode: '400' | ||
responseModels: | ||
"application/json": 400JsonResponse | ||
functions: | ||
signUp: | ||
handler: handler.signUp | ||
events: | ||
- http: | ||
documentation: | ||
summary: "Register user" | ||
description: "Registers new user" | ||
tags: | ||
- User | ||
requestModels: | ||
"application/json": RegisterUserRequest | ||
method: post | ||
path: signup | ||
reqValidatorName: onlyBody | ||
methodResponses: | ||
- statusCode: '200' | ||
responseModels: | ||
"application/json": RegisterUserResponse | ||
- ${self:custom.commonModelSchemaFragments.MethodResponse400Json} | ||
package: | ||
include: | ||
handler.ts | ||
resources: | ||
Resources: | ||
onlyBody: | ||
Type: "AWS::ApiGateway::RequestValidator" | ||
Properties: | ||
Name: 'only-body' | ||
RestApiId: | ||
Ref: ApiGatewayRestApi | ||
ValidateRequestBody: true | ||
ValidateRequestParameters: false | ||
``` |
@@ -50,3 +50,3 @@ 'use strict'; | ||
this.hooks = { | ||
'before:deploy:deploy': this._beforeDeploy | ||
'before:package:finalize': this._beforeDeploy | ||
}; | ||
@@ -109,2 +109,2 @@ | ||
module.exports = ServerlessReqValidatorPlugin; | ||
module.exports = ServerlessReqValidatorPlugin; |
9145
89
210