js-yaml-cloudformation-schema
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

js-yaml-cloudformation-schema Build Status

Schema to allow js-yaml to process YAML formatted CloudFormation templates that use short form syntax for intrinsic functions while parsing or dumping, for example: !Ref, !Base64.

See tags.json for currently supported short form syntax for intrinsic functions, also known as local tags in the YAML spec.

This is a fork of yyolk/cloudformation-js-yaml-schema that changes the structure of the parsed JavaScript representation of the CloudFormation template to match the parsed representation of a JSON formatted CloudFormation template.

Usage

const yaml = require('js-yaml');
const { CLOUDFORMATION_SCHEMA } = require('js-yaml-cloudformation-schema');
 
let templateBody = fs.readFileSync(templatePath, 'utf8');
templateBody = yaml.safeLoad(templateBody, { schema: CLOUDFORMATION_SCHEMA });
console.log(JSON.stringify(templateBody, null, 2));
 
templateBody = yaml.safeDump(templateBody, { schema: CLOUDFORMATION_SCHEMA });
console.log(templateBody);

Package Sidebar

Install

npm i js-yaml-cloudformation-schema

Weekly Downloads

90,541

Version

1.0.0

License

ISC

Unpacked Size

10.2 kB

Total Files

10

Last publish

Collaborators

  • danmactough