RafPe / Serverless Reqvalidator Plugin
Serverless plugin to attach AWS API Gateway Basic Request Validation https://rafpe.ninja/2017/12/18/serverless-own-plugin-to-attach-aws-api-gateway-basic-request-validation/
Stars: ✭ 59
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Serverless Reqvalidator Plugin
Serverless Step Functions
AWS Step Functions plugin for Serverless Framework ⚡️
Stars: ✭ 758 (+1184.75%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Plugin Git Variables
⚡️ Expose git variables to serverless
Stars: ✭ 75 (+27.12%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Plugin Typescript
Serverless plugin for zero-config Typescript support
Stars: ✭ 611 (+935.59%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Openwhisk
Adds Apache OpenWhisk support to the Serverless Framework!
Stars: ✭ 131 (+122.03%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+4349.15%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Wsgi
Serverless plugin to deploy WSGI applications (Flask/Django/Pyramid etc.) and bundle Python packages
Stars: ✭ 377 (+538.98%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Plugins
Serverless Plugins – Extend the Serverless Framework with these community driven plugins –
Stars: ✭ 850 (+1340.68%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Sentry Plugin
This plugin adds automatic forwarding of errors and exceptions to Sentry (https://sentry.io) and Serverless (https://serverless.com)
Stars: ✭ 146 (+147.46%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Awesome Serverless
DEPRECATED: Curated list of resources related to serverless computing and serverless architectures.
Stars: ✭ 2,049 (+3372.88%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Plugin Canary Deployments
Canary deployments for your Serverless application
Stars: ✭ 283 (+379.66%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-13.56%)
Mutual labels: serverless, serverless-framework, serverless-plugin
Serverless Appsync Plugin
serverless plugin for appsync
Stars: ✭ 804 (+1262.71%)
Mutual labels: serverless-framework, serverless-plugin
Serverless Nodejs Starter
A Node.js starter for Serverless Framework with ES6 and TypeScript support
Stars: ✭ 683 (+1057.63%)
Mutual labels: serverless, serverless-framework
Serverless Aws Lambda Node Postgres
Serverless AWS Lambda with Node.js,Postgres Rest API with Sequelize.
Stars: ✭ 18 (-69.49%)
Mutual labels: serverless, serverless-framework
Serverless Plugin Warmup
Keep your lambdas warm during winter. ♨
Stars: ✭ 814 (+1279.66%)
Mutual labels: serverless, serverless-plugin
Serverless Dynalite
Serverless plugin to run Dynalite locally (No JVM needed!) to handle DynamoDB development. Can watch for table config changes.
Stars: ✭ 19 (-67.8%)
Mutual labels: serverless, serverless-plugin
Node Dash
Serverless setup using node.js
Stars: ✭ 13 (-77.97%)
Mutual labels: serverless, serverless-framework
Serverless Authentication Boilerplate
Generic authentication boilerplate for Serverless framework
Stars: ✭ 563 (+854.24%)
Mutual labels: serverless, serverless-framework
Serverless Python Requirements
⚡️🐍📦 Serverless plugin to bundle Python packages
Stars: ✭ 838 (+1320.34%)
Mutual labels: serverless, serverless-plugin
Graphql Serverless
Sample project to guide the use of GraphQL and Serverless Architecture.
Stars: ✭ 28 (-52.54%)
Mutual labels: serverless, serverless-framework
serverless-reqvalidator-plugin
Serverless plugin to set specific validator request on method
Installation
npm install serverless-reqvalidator-plugin
Requirements
This require you to have documentation plugin installed
serverless-aws-documentation
Using plugin
Specify plugin
plugins:
- serverless-reqvalidator-plugin
- serverless-aws-documentation
In serverless.yml
create custom resource for request validators
xMyRequestValidator:
Type: "AWS::ApiGateway::RequestValidator"
Properties:
Name: 'my-req-validator'
RestApiId:
Ref: ApiGatewayRestApi
ValidateRequestBody: true
ValidateRequestParameters: false
For every function you wish to use the validator set property reqValidatorName: 'xMyRequestValidator'
to match resource you described
debug:
handler: apis/admin/debug/debug.debug
timeout: 10
events:
- http:
path: admin/debug
method: get
cors: true
private: true
reqValidatorName: 'xMyRequestValidator'
Use Validator specified in different Stack
The serverless framework allows us to share resources among several stacks. Therefore a CloudFormation Output has to be specified in one stack. This Output can be imported in another stack to make use of it. For more information see here.
Specify a request validator in a different stack:
plugins:
- serverless-reqvalidator-plugin
service: my-service-a
functions:
hello:
handler: handler.myHandler
events:
- http:
path: hello
reqValidatorName: 'myReqValidator'
resources:
Resources:
xMyRequestValidator:
Type: "AWS::ApiGateway::RequestValidator"
Properties:
Name: 'my-req-validator'
RestApiId:
Ref: ApiGatewayRestApi
ValidateRequestBody: true
ValidateRequestParameters: false
Outputs:
xMyRequestValidator:
Value:
Ref: my-req-validator
Export:
Name: myReqValidator
Make use of the exported request validator in stack b:
plugins:
- serverless-reqvalidator-plugin
service: my-service-b
functions:
hello:
handler: handler.myHandler
events:
- http:
path: hello
reqValidatorName:
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:
- email
- 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
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].