Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/bindings-jvm/generated/cloudformation-validate.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bindings-jvm/version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by generate-version-properties.sh — do not edit manually.
publishVersion=1.5.0
publishVersion=1.6.0
jnaVersion=5.19.1
gsonVersion=2.14.0
49 changes: 32 additions & 17 deletions src/bindings-wasm/dist/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
# CloudFormation Validate WASM Bindings
# CloudFormation Validate for Node.js

WASM bindings for [`cloudformation-validate`](https://github.com/aws-cloudformation/cloudformation-validate). Compiles
the full validation pipeline —
template parser, schema validator, Rego engine, and CEL engine — into a single `.wasm` module for Node.js.
Validate AWS CloudFormation templates from JavaScript or TypeScript and catch schema violations, security risks, and
best-practice findings before deployment — in your editor, build, or CI.

All WASM objects must be explicitly freed via `.free()` to release memory.
- **Offline** — all rules and resource schemas are bundled.
- **Fast** — sub-second validation per template.

For a complete, runnable example, see
[examples](https://github.com/aws-cloudformation/cloudformation-validate/tree/main/src/bindings-wasm/examples).
## Installation

## Engine
Available on [npm](https://www.npmjs.com/package/@aws/cloudformation-validate) as `@aws/cloudformation-validate`.

`RegoEngine` and `CelEngine` both implement the `Engine` interface. They are interchangeable — both produce identical
diagnostics for the same template and config.
```bash
npm install @aws/cloudformation-validate
```

## Quick start

Engines, models, and validators hold off-heap memory — call `.free()` when done with each object:

```typescript
import { RegoEngine, CelEngine, TemplateFile } from "@aws/cloudformation-validate";
import { RegoEngine, TemplateFile } from "@aws/cloudformation-validate";

const engine = new RegoEngine();
const report = engine.validateStandard(new TemplateFile("template.yaml"));

for (const d of report.diagnostics) {
console.log(`[${d.severity}] ${d.ruleId}: ${d.message}`);
try {
const report = engine.validateStandard(new TemplateFile("template.yaml"));
for (const d of report.diagnostics) {
console.log(`[${d.severity}] ${d.ruleId}: ${d.message}`);
}
} finally {
engine.free();
}
engine.free();
```

Each diagnostic identifies the rule, severity, affected resource and property, and source location — see
[StandardDiagnostic](#standarddiagnostic). A complete, runnable project is in
[examples](https://github.com/aws-cloudformation/cloudformation-validate/tree/main/src/bindings-wasm/examples).

## Engine

`RegoEngine` and `CelEngine` both implement the `Engine` interface and are interchangeable — they produce identical
diagnostics for the same template and config.

### `Engine` interface

| Method | Returns | Description |
Expand All @@ -34,7 +49,7 @@ engine.free();
| `validateDetailed(template, config?)` | `DetailedReport` | Validates and returns diagnostics with documentation URLs, rule descriptions, phase tags, and `ViolationContext` |
| `listRules()` | `RuleInfo[]` | Returns metadata for every built-in and loaded custom rule |
| `engineName()` | `string` | `"rego"` or `"cel"` |
| `free()` | `void` | Releases WASM memory |
| `free()` | `void` | Releases the engine's off-heap memory |

### `EngineConfig`

Expand Down
Binary file modified src/bindings-wasm/dist/bindings_wasm_bg.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/bindings-wasm/dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws/cloudformation-validate",
"version": "1.5.0",
"version": "1.6.0",
"description": "AWS CloudFormation Validate",
"keywords": [
"aws",
Expand Down
Binary file modified src/release/cfn-validate-darwin-aarch64
Binary file not shown.
Binary file modified src/release/cfn-validate-linux-x64
Binary file not shown.
Binary file modified src/release/cfn-validate-win32-x64.exe
Binary file not shown.