
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@bpmn-io/element-templates-validator
Advanced tools
Validate element templates based on JSON Schema.
npm i --save @bpmn-io/element-templates-validator
Given an example element template:
import { validate } from '@bpmn-io/element-templates-validator';
import sample from './test/fixtures/rpa-broken.json';
const {
valid,
errors
} = validate(sample);
if (!valid) {
console.error('Invalid JSON detected:', errors);
}
This will print detailed information about errors inside the sample:
[
{
"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.
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
} = 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.
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));
}
MIT
2.13.0
FEAT: support activeElementsCollection property on zeebe:adHoc (camunda/element-templates-json-schema#198)DEPS: update to @camunda/zeebe-element-templates-json-schema@0.31.1FAQs
Validate element templates based on JSON Schema
The npm package @bpmn-io/element-templates-validator receives a total of 10,919 weekly downloads. As such, @bpmn-io/element-templates-validator popularity was classified as popular.
We found that @bpmn-io/element-templates-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.