{"id":47267,"library":"cloudformation-js-yaml-schema","title":"CloudFormation JS-YAML Schema","description":"Provides a custom js-yaml schema that allows parsing and dumping CloudFormation YAML files while ignoring or handling CloudFormation-specific local tags like !Ref, !Base64, !GetAtt, etc. Current stable version 0.4.2. Useful for linting, validation, and transformation of CloudFormation templates in JavaScript. Differentiates from general YAML parsers by preserving CFN intrinsic functions without throwing parse errors. Release cadence is low (last update May 2021).","status":"active","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/yyolk/cloudformation-js-yaml-schema","tags":["javascript","cloudformation","aws","js-yaml","yaml","parser","schema","typescript"],"install":[{"cmd":"npm install cloudformation-js-yaml-schema","lang":"bash","label":"npm"},{"cmd":"yarn add cloudformation-js-yaml-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add cloudformation-js-yaml-schema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required to define custom schema","package":"js-yaml","optional":false}],"imports":[{"note":"ESM default; works with both ESM and CJS environments","wrong":"const { cloudformationSchema } = require('cloudformation-js-yaml-schema')","symbol":"cloudformationSchema","correct":"import { cloudformationSchema } from 'cloudformation-js-yaml-schema'"},{"note":"Named export; do not use default import","wrong":"import ignoreTags from 'cloudformation-js-yaml-schema'","symbol":"ignoreTags","correct":"import { ignoreTags } from 'cloudformation-js-yaml-schema'"},{"note":"Exports a list of supported tag names (e.g., !Ref, !GetAtt)","symbol":"tags","correct":"import { tags } from 'cloudformation-js-yaml-schema'"}],"quickstart":{"code":"import { cloudformationSchema } from 'cloudformation-js-yaml-schema';\nimport yaml from 'js-yaml';\n\nconst cfnYaml = `\nResources:\n  MyBucket:\n    Type: 'AWS::S3::Bucket'\n    Properties:\n      BucketName: !Ref BucketNameParam\n`;\n\nconst doc = yaml.load(cfnYaml, { schema: cloudformationSchema });\nconsole.log(doc);\n// Output: { Resources: { MyBucket: { Type: 'AWS::S3::Bucket', Properties: { BucketName: { '!Ref': 'BucketNameParam' } } } } }","lang":"typescript","description":"Parses CloudFormation YAML with CFN tags using custom schema."},"warnings":[{"fix":"Access tags via obj['!Ref'] or similar, not as plain strings.","message":"Custom tags are represented as objects with key '!TagName', not as native YAML tag.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always pass { schema: cloudformationSchema } to yaml.load/dump when working with CloudFormation templates.","message":"Using with js-yaml's default or other schemas may cause parse errors for CFN tags.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Import { tags } from 'cloudformation-js-yaml-schema' instead of reading tags.json.","message":"The tags.json file is no longer the authoritative source; use the exported ``tags`` array.","severity":"deprecated","affected_versions":">=0.4.0"}],"env_vars":null,"search_vec":"'0.4.2':38 '2021':71 'allow':14 'aw':74 'base64':32 'cadenc':65 'cfn':57 'cloudform':1,18,26,46,73 'cloudformation-specif':25 'current':35 'custom':8 'differenti':50 'dump':17 'error':63 'etc':34 'file':20 'function':59 'general':52 'getatt':33 'handl':24 'ignor':22 'intrins':58 'javascript':49,72 'js':3,10,76 'js-yaml':2,9,75 'last':68 'like':30 'lint':41 'local':28 'low':67 'may':70 'pars':15,62 'parser':54,79 'preserv':56 'provid':6 'ref':31 'releas':64 'schema':5,12,80 'specif':27 'stabl':36 'tag':29 'templat':47 'throw':61 'transform':44 'typescript':81 'updat':69 'use':39 'valid':42 'version':37 'without':60 'yaml':4,11,19,53,77,78","created_at":"2026-06-07T16:50:38.993332+00:00","updated_at":"2026-06-07T16:50:38.993332+00:00","problems":[{"fix":"Set schema: cloudformationSchema in yaml.load options.","cause":"Using js-yaml's default schema without the CloudFormation schema.","error":"TypeError: Cannot read properties of undefined (reading 'toString')"},{"fix":"Use the cloudformationSchema as shown in quickstart.","cause":"js-yaml doesn't recognize CloudFormation tags by default.","error":"Unknown tag: !Ref"},{"fix":"Run npm install js-yaml.","cause":"js-yaml is a peer dependency not installed automatically.","error":"Cannot find module 'js-yaml'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/yyolk/cloudformation-js-yaml-schema#readme","github":"https://github.com/yyolk/cloudformation-js-yaml-schema","docs":null,"changelog":null,"pypi":null,"npm":"cloudformation-js-yaml-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}