# @bpmn-io/element-templates-validator

> Validate element templates based on JSON Schema

Latest version **2.26.0** (published 2026-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bpmn-io/element-templates-validator
pnpm add @bpmn-io/element-templates-validator
yarn add @bpmn-io/element-templates-validator
bun add @bpmn-io/element-templates-validator
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.26.0 |
| Published | 2026-08-20 |
| First published | 2021-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 1.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Maciej Barelkowski |
| Maintainers | bpmn-io-admin, nikku, barmac, philippfromme, maxtru, skaiir-camunda, vsgoulart, barinali, ev-camunda, jarekdanielak, alekseymanetov |
| Keywords | json-schema, json-schema-validator, element templates, validator, validation |

## Links

- npm: https://www.npmjs.com/package/@bpmn-io/element-templates-validator
- Repository: https://github.com/bpmn-io/element-templates-validator
- Homepage: https://github.com/bpmn-io/element-templates-validator#readme
- Issues: https://github.com/bpmn-io/element-templates-validator/issues
- npm.io page: https://npm.io/package/@bpmn-io/element-templates-validator

## Dependencies (5)

- [min-dash](https://npm.io/package/min-dash.md) ^5.0.0
- [json-source-map](https://npm.io/package/json-source-map.md) ^0.6.1
- [@camunda/element-templates-json-schema](https://npm.io/package/@camunda/element-templates-json-schema.md) ^0.22.1
- [@camunda/zeebe-element-templates-json-schema](https://npm.io/package/@camunda/zeebe-element-templates-json-schema.md) ^0.46.0
- [@camunda/zeebe-configuration-templates-json-schema](https://npm.io/package/@camunda/zeebe-configuration-templates-json-schema.md) ^0.2.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 2.26.0 (latest) — 2026-08-20
- 2.24.0-alpha.0 (next) — 2026-06-29
- 2.20.2 (patch) — 2026-06-29
- 2.25.0 — 2026-07-24
- 2.24.0 — 2026-07-16
- 2.23.0 — 2026-06-25
- 2.22.0 — 2026-05-26
- 2.21.0 — 2026-04-23
- 2.20.1 — 2026-03-23
- 2.20.0 — 2026-03-19
- 2.19.0 — 2026-03-02
- 2.18.0 — 2026-02-24
- 2.17.0 — 2026-01-29
- 2.16.0 — 2025-12-16
- 2.15.0 — 2025-12-15
- … 46 more at https://npm.io/package/@bpmn-io/element-templates-validator/versions

## README

# element-templates-validator

[![CI](https://github.com/bpmn-io/element-templates-validator/actions/workflows/CI.yml/badge.svg)](https://github.com/bpmn-io/element-templates-validator/actions/workflows/CI.yml)

Validate element templates based on [JSON Schema](https://github.com/camunda/element-templates-json-schema).

## Installation

```sh
npm i --save @bpmn-io/element-templates-validator
```

## Usage

Given an [example element template](./test/fixtures/rpa-broken.json):

```js
import { validate } from '@bpmn-io/element-templates-validator';

import sample from './test/fixtures/rpa-broken.json';

const {
  valid,
  errors,
  warnings
} = validate(sample);

if (!valid) {
  console.error('Invalid JSON detected:', errors);
}
```

This will print detailed information about errors and warnings inside the sample:

```json
[
  {
    "keyword": "type",
    "dataPath": "",
    "schemaPath": "#/type",
    "params": {
      "type": "object"
    },
    "message": "must be object",
    "dataPointer": {
      "value": {
        "line": 0,
        "column": 0,
        "pos": 0
      },
      "valueEnd": {
        "line": 177,
        "column": 1,
        "pos": 4825
      }
    }
  }
  ...
]
```

You can also pass a stringified template to ensure that the `dataPointers` of the errors reflect the correct position in the original string.

```js
import { validate } from '@bpmn-io/element-templates-validator';

import { readFileSync } from 'node:fs';

const sample = readFileSync('./test/fixtures/rpa-broken.json', 'utf-8');

const {
  valid,
  errors,
  warnings
} = validate(sample);

if (!valid) {
  console.error('Invalid JSON detected:', errors);
}
```

If a parsed JSON object is passed, the `dataPointers` will assume that the source template is formatted with `JSON.stringify(template, null, 2)`.

It's also possible to validate multiple objects at once. In this case, the list of templates supports only objects, not strings.

```js
import { validateAll } from '@bpmn-io/element-templates-validator';

import samples from './test/fixtures/multiple-errors.json';

const {
  valid,
  results
} = validateAll(samples);

if (!valid) {
  console.error('Invalid JSON objects detected:', results.filter(r => !r.valid));
}
```

## License

MIT

---
_Source: https://npm.io/package/@bpmn-io/element-templates-validator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
