Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Guts opened this issue Apr 5, 2024 · 1 comment
Open

Comments

@Guts
Copy link

Guts commented Apr 5, 2024

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

@chris-dco
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants