vinzdeveloper / json-rule-editor

Json rule editor
GNU General Public License v3.0
375 stars 109 forks source link

Integrate editor in another application #63

Open risacher opened 1 year ago

risacher commented 1 year ago

Is it possible to integrate the rule editor as part of another application that uses json-rule-engine? E.g. suppose I have an existing application that uses json-rules-engine and has a web UI implemented with express. Can I serve out json-rule-editor and link it? I'm aware from the documentation that it doesn't need this integration, but it seems like it would be useful to pre-populate the existing rules and facts. If this is already possible, can it be documented more obviously?

vinzdeveloper commented 1 year ago

Well, the whole idea of having this UI is to integrate with any applications to manage the json rules via user interface. But in order to display / configure the rules in Json rule editor, it has to follow certain format as below example.

https://github.com/vinzdeveloper/json-rule-editor/tree/master/examples

Thought process was to create the business rules via json rule editor UI first, validate your rules if need, generate the rule and configure the generated file in your web application. if you want to update the rule sheet in future, import the same rule file in json rule editor, edit the rule, generate again and configure it in your app.

As this json rule editor is available in open site, you dont necessarily need to clone and deploy anywhere in your machines or server.

Link: www.json-rule-editor.com

risacher commented 1 year ago

Understood - although I'm building an application that uses json-rules-engine, and I'd like a UI for creating and manipulating the rules. Asking the users to export a rule, re-import into another site, re-export from the editor, re-import into the app, and then test it is pretty cumbersome. You might consider making the rules-editor a re-usable module rather than a standalone application. This might also allow the app to provide a list of the available (or expected) facts for the rules to work on.

vinzdeveloper commented 1 year ago

thanks for your suggestion @risacher. Agree, it has to be exported and configured in actual web application. TBH i haven't put more thought process on embedding this UI into web application. As this json rule editor built on react framework, have to analyse how to make it easy to add this UI packages into any server/client based web application.

My initial idea was to keep this standalone rule editor. so not only developers, even testers or business analyst can manage the rule sheet separately which including testing the rule sheet separately ie. they dont need to run each and every scenario in actual application. One simple alternative solution i can think of is, simply add the json rule editor UI as link in your actual web application and enable the link based on user role like developer/admin. Though it wont resolve the problem of import and export problem, it atleast keep the editor attached to your application and you can import/export the sheet from/into your actual source code location itself.

ellisium commented 6 months ago

+1 to get a library version as well