@awboost/cfn-resource-schemas

0.2.1 • Public • Published

@awboost/cfn-resource-schemas

Fetch and validate the latest CloudFormation Resource Schemas from AWS.

import { fetchResourceSchemas } from "@awboost/cfn-resource-schemas";

// fetchResourceSchemas returns an async generator
for await (const schema of downloadAwsResourceSchemas()) {
  // do something with the schema
}

Function downloadAwsResourceSchemas

Get the latest schemas.

import { downloadAwsResourceSchemas } from "@awboost/cfn-resource-schemas";
export async function* downloadAwsResourceSchemas({
  skipValidate = false,
  url = "https://schema.cloudformation.us-east-1.amazonaws.com/CloudformationSchema.zip",
}: DownloadAwsResourceSchemasOptions): AsyncGenerator<
  ResourceTypeSchema & { $id: string }
>;

Type ResourceTypeSchema

Description of a CloudFormation resource.

import { ResourceTypeSchema } from "@awboost/cfn-resource-schemas/types";

Parsed representation

This package also provides a set of node classes to represent schemas, similar to an AST. There are available from the "@awboost/cfn-resource-schemas/nodes" module path.

import { SchemaFileNode } from "@awboost/cfn-resource-schemas/nodes";
import { readFile } from "node:fs/promises";

const path = "path-to-schema.json";
const schema = JSON.parse(await readFile(path, "utf-8"));
const schemaFile = new SchemaFileNode(schema, path);

Readme

Keywords

none

Package Sidebar

Install

npm i @awboost/cfn-resource-schemas

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

268 kB

Total Files

29

Last publish

Collaborators

  • gordonmleigh