Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-reqvalidator-plugin

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-reqvalidator-plugin - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

test/fixtures/externalValidatorId.yaml

2

package.json
{
"name": "serverless-reqvalidator-plugin",
"version": "3.0.0",
"version": "3.1.0",
"description": "Serverless plugin for setting request validation",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -106,2 +106,19 @@ # serverless-reqvalidator-plugin

### Use an external validator by ID
If you have an existing request validator defined outside of CloudFormation e.g. Terraform, you can reference it by id.
```
plugins:
- serverless-reqvalidator-plugin
service: my-service-a
functions:
hello:
handler: handler.myHandler
events:
- http:
path: hello
reqValidatorName:
id: 'g5ch0h'
```
### Full example

@@ -108,0 +125,0 @@ ```

@@ -32,2 +32,17 @@ 'use strict';

*
* Use request validator by Id:
*
* myFuncGetItem:
* handler: myFunc.get
* name: ${self:provider.stage}-myFunc-get-item
* events:
* - http:
* method: GET
* path: mypath
* cors: true
* reqValidatorName:
* id: 'g5ch0h'
*
*
*
* Resources used:

@@ -48,2 +63,8 @@ * - https://www.snip2code.com/Snippet/1467589/adds-the-posibility-to-configure-AWS_IAM/

},
{ type: 'object',
properties: {
id: { type: 'string' },
},
required: ['id'],
},
]

@@ -111,2 +132,4 @@ },

resources[methodName].Properties.RequestValidatorId = reqValidatorName;
} else if (reqValidatorName['id']) {
resources[methodName].Properties.RequestValidatorId = reqValidatorName['id']
} else { // other use cases should be added here

@@ -113,0 +136,0 @@ resources[methodName].Properties.RequestValidatorId = reqValidatorName;

@@ -41,2 +41,9 @@ const Ajv = require('ajv');

});
it('should validate a configuration with an external reqValidatorName.id property', () => {
const config = yaml.load(fs.readFileSync('./test/fixtures/externalValidatorId.yaml', 'utf8'));
const valid = validateConfig(config.functions.hello.events[0].http);
expect(valid).toBeTruthy();
})
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc