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

cloud-config-toolkit-ajv

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloud-config-toolkit-ajv

Cloud config toolkit ajv integration

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Cloud config toolkit ajv

Cloud config toolkit ajv implements the validator and exporter interfaces required by Cloud config toolkit. It uses Ajv schema validator.

Installation

Install the package in the project:

npm install --save cloud-config-toolkit-ajv

Then use Validator and Exporter constructors in cct.conf.js:

// `cct.conf.js`
const { Validator, Exporter } = require('cloud-config-toolkit-ajv');

const schema = {
  "type": "object",
  "properties": {
    "foo": { "type": "string" },
    "bar": { "type": "integer" },
    "baz": {
      "range": [2, 4], 
      "exclusiveRange": true,
      "type": "integer"
    }
  }
};
const keywords = [{
  name: 'range',
  definition: {
    type: 'number',
    compile: function (sch, parentSchema) {
      const min = sch[0];
      const max = sch[1];

      return parentSchema.exclusiveRange === true
        ? function (data) { return data > min && data < max; }
        : function (data) { return data >= min && data <= max; }
    }
  }
}];

module.exports = {
  validator: new Validator({
    schema,
    keywords
  }),
  exporter: new Exporter({
    schema,
    keywords
  }),
  // ...
};

Configuration

Both Validator and Exporter constructors accept a configuration object with properties:

  • schema - schema to validate JSON (see Ajv for more details);
  • keywords - an array of custom keywords used by schema.

For more details check Cloud config toolkit documentation.

Keywords

FAQs

Package last updated on 27 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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