CacheControl/json-rules-engine

Is the project providing an official JSON Schema to validate rules edition?

Guts opened this issue · 1 comments

Guts commented

Thank you for this project, which I recently discovered and which I'm about to push as part of a Python project using https://github.com/santalvarez/python-rule-engine.

I'm looking to allow end users to edit their rules in JSON with validation using a schema. Is there somewhere in this repository a way to typically integrate something similar to "$schema": "https://raw.githubusercontent.com/CacheControl/json-rules-engine/master/docs/schemas/rules.json" into JSON files?

Related to #203

I was recently interested in generating a schema to validate my rules against. I found I could generate my schema using the json-rules-engine source code using the NPM package ts-json-schema-generator.

npx ts-json-schema-generator --path types/index.d.ts --type RuleProperties

You can also generate the schema for Conditions using the following:

npx ts-json-schema-generator --path types/index.d.ts --type TopLevelCondition