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

cloudformation-schema-js-yaml

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudformation-schema-js-yaml

js-yaml Schema for handling Cloudformation's custom classes

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
342
decreased by-13.64%
Maintainers
1
Weekly downloads
 
Created
Source

Cloudformation Schema for use with js-yaml

Cloudformation supports custom yaml classes, e.g. !Ref, !Sub, !If, etc. Yaml parsers will choke on these custom classes unless the classes are specified. Use this library with js-yaml to parse cloudformation templates with these classes. The cloudformation classes are converted into objects that are similar to the non custom class syntax e.g. Ref, Fn::Sub, Fn::If

Usage

const yaml = require('js-yaml');
const schema = require('cloudformation-schema-js-yaml');
const fs = require('fs');

let file = fs.readFileSync('somefile.yaml');
let data = yaml.load(file, { schema: schema});

Example

sample.yaml

test:
  - !Ref someLogicalId
  - !Sub A string with a substitution ${someLogicalId}

Program extract

let file = fs.readFileSync('sample.yaml');
let data = yaml.load(file, { schema: schema});
console.log(data)
console.log('%j', data)

Output

{ test:
   [ Obj { Ref: 'someLogicalId' },
     Obj { 'Fn::Sub': 'A string with a substitution ${someLogicalId}' } ] }
{"test":[{"Ref":"someLogicalId"},{"Fn::Sub":"A string with a substitution ${someLogicalId}"}]}

Dependencies

None

Peer-dependencies

This this library is meant to be used with js-yaml it has a peer dependency of js-yaml

Tests

npm test

Keywords

FAQs

Package last updated on 23 Jun 2022

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