Coder Social home page Coder Social logo

akmjenkins / json-schema-rules-engine Goto Github PK

View Code? Open in Web Editor NEW
46.0 2.0 1.0 851 KB

A highly configurable and dynamic rules engine based on JSON Schema

License: MIT License

JavaScript 29.92% TypeScript 70.08%
rules json rules-engine engine rules-processor business-rules rule-engine json-rules-engine json-schema json-schema-validator

json-schema-rules-engine's People

Contributors

akmjenkins avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

maclezhou

json-schema-rules-engine's Issues

Conditional Validation in repeated list component

Can anybody help me how to apply conditional validation in a repeated list component using json rules engine
scenarios - I have radio button or dropdown field on the basis of each values in the radio button or dropdown i need to apply show and hide condition
example - radio button have option

  1. Show
  2. Hide
  3. Both

and i have 3 input fields

  1. Show
  2. Hide
  3. Both

if i select radio button option show then only show option should visible others 2 are not. Similarly if i click radio button option Hide then input fields Hide should visible same for Both option .but that i need to add in a repeated list option if i click add button then again radio button and respective option should come i have performed validations on the basis of index but that one i not working .
Outside the list same is working but not in a list

[
{
"conditions" : {
"task210[0].radiobutton" : "empty"
},
"event" : {
"type": "remove",
"params" : {
"field": [
"task210[0].show",
"task210[0].hide"
]
}
}
},
{
"conditions" : {
"task210[0].radiobutton" : {
"equal" : "Show"
}
},
"event" : {
"type": "remove",
"params" : {
"field": [
"task210[0].hide",
"task210[0].both"
]
}
}
},
{
"conditions" : {
"task210[0].radiobutton" : {
"equal" : "Hide"
}
},
"event" : {
"type": "remove",
"params" : {
"field": [
"task210[0].show",,
"task210[0].both"
]
}
}
},
{
"conditions" : {
"task210[0].radiobutton" : {
"equal" : "Both"
}
},
"event" : {
"type": "remove",
"params" : {
"field": [
"task210[0].show",,
"task210[0].hide"
]
}
}
}
]

//here task210 is my repeated list elementName
//radiobutton -> is my radiobutton elementName
//hide, show, and both are input fields elementName
//Hide, Show, And Both are - radio button options value

if anybody help me in this that would be great

Cheers!!

schema for services who get the rule selection

Can you share with me if there is a universally agreed upon standard for sending rules over HTTP via JSON?

Because I notice that there is a specific type for the output mentioned in the readme, but some of this (like the memorizer and resolver) are not JSON serializable since they are functions.

type Options = {
  facts?: Record<string,Fact>;
  rules?: Record<string,Rule>;
  actions?: Record<string,Action>;
  pattern?: RegExp; // for interpolation
  memoizer?: <T>(a: T, b: T) => boolean;
  resolver?: (subject: Record<string,any>, path: string) => any
};

So what I’m looking for is a JSON Schema spec that I can point to to say “this is what the API that reads the rule selections expects to receive.”

For full context, my team is building a temporary component that we will replace with your React component. So having a standardized output will allow us to make that swap easily (ie the adapter pattern). And it will let us start building the services before the UI is written. Thank you for the guidance.

stupid question, how to do logical or/and?

I am trying to evaluate the different json rules engine. Since this library uses AJV, how do you do a logical or/and? for example:

when :[
           {
               firstName: { is: { type: 'string', pattern: '^J' } },
          },
         {
                             firstName: { is: { type: 'string', pattern: '^A' } },
         }
]

I assume this is an AND operator right? how do you do an OR?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.