Giter Site home page Giter Site logo

business-rules-engine's People

Contributors

rsamec 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  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  avatar  avatar

Watchers

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

business-rules-engine's Issues

Enhancement: We should be able to split JSON Schema Validation input into templates residing in separate files-

So i use file system to maintain json templates.

I notice that we can introduce a feature where can split the JSON Schema into small reusable chunks and then create a final JSON Schema Validation object... using lodash _.assign

we can introduce assign key

So let's say we have firstName and lastName section common between lots of different Schemes. I should be able to write this template outside and using nodeJS require i should be able to assign this template to my final JSON Schema validation.

var nameTemplate = {
        FirstName: {
            type: "string",
            title: "First name",
            required: "true",
            maxLength: 15
        },
        LastName: {
            type: "string",
            "title": "Last name",
            required: true,
            maxLength: 15
        }
}

so final JSON Schema will become somthing like this-

assign:[{
nameTemplate,
Contacts: {
            type: "array",
            maxItems: 4,......
}]

This will make the JSON Schema's to share the templates and we don't have to redefine the templates again and again.

Let me know if it makes sense and i can create a PR.

Thanks,
Sameer

Problem with RangeValidator

I was trying to use the default RangeValidator but ran into an issue where it was always returning false

it('should return false when value is not in range', inject(function( ) {
var range = [5,11]
var validatorMin = new Validators.RangeValidator(range);

    expect(validatorMin.isAcceptable(4)).toBeFalsy();
}));

I looked at the source for the range validator and found it was trying to use length for the comparison
if (!_.isNumber(s))
s = parseFloat(s);
return s.length >= this.Min && s.length <= this.Max;

I think it should have been return s >= this.Min && s <= this.Max;
once i changed this line, the test started passing

Issues with building from source

I tried to build the project from source, however I ran into a couple of issues.
The first one was the underscore package was looking for a version no longer available, so I modified it from "underscore": "1.0.6", to "underscore": "^1.0.6",

the second issue, there were some missing required packages in the devDependencies section
"coffee-script": "^1.6.3",
"grunt-contrib-coffee": "^0.10.1",
"grunt-coffeelint": "0.0.8"

Once I made those changes, I was able to issue the grunt test command, but that threw a missing file error.
Cannot resolve referenced file: '../../typings/business-rules-engine/business-rules-engine.d.ts'.

Looks like the type script files for the project are missing from source control. Would it be possible for you to check those into git?

Thanks
rick

TS errors: Can't get the project to build, test or grunt typings to work.

โ€ฆ but this PR is slightly incomplete as it doesn't have tests. This is because I can not get the project to build / test / install typings.

I get only awful lot of Typescript related errors, like these when running grunt typings:

>> error TS1005: ',' expected.
>> /Users/me/projects/business-rules-engine/typings/underscore/underscore.d.ts(6033,42):
>> error TS1005: ';' expected.
>> /Users/me/projects/business-rules-engine/typings/underscore/underscore.d.ts(6033,53):
>> error TS1003: Identifier expected.
>> /Users/me/projects/business-rules-engine/typings/underscore/underscore.d.ts(6042,14):
>> error TS1005: ',' expected.
>> /Users/me/projects/business-rules-engine/typings/underscore/underscore.d.ts(6042,32):
>> error TS1005: ',' expected.
>> /Users/me/projects/business-rules-engine/typings/underscore/underscore.d.ts(6042,42):

Can it be related to this issue DefinitelyTyped/DefinitelyTyped#4004 ?

How does one specify what language (localization) is used?

I have trouble understanding how to use different translations in my app, I know this is more of a question (which generally should go to StackOverflow), but I think README.md should have an example of using localization.

Let's say I have the following setup:

const FormSchema = require('business-rules-engine/commonjs/FormSchema');
const schema = {
  foo: {
    type: 'string',
    minLength: 100,
    required: true,
    title: 'Foo',
  },
}
const validator = new FormSchema.JsonSchemaRuleFactory(schema).CreateRule('foo');

const result = validator.Validate({ foo: 'not long enough' });
console.log(result.ErrorMessage);

Considering that example code, how would one go and specify that in which language the messages result.ErrorMessage are displayed?

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.