json-schema-rules-engine icon indicating copy to clipboard operation
json-schema-rules-engine copied to clipboard

Difference between Context and Facts

Open fhirter opened this issue 1 year ago • 0 comments

From the README it do not fully understand the difference between "facts" and "context".

In the basic example "facts" seems to be the data on which the business rules are applied. The "context" can be used to parametrize rules. Is this correct?

Why does it state below context that "It [context] can be used for interpolation or even as a source of facts". In this chapter it seems that context is being evaluated agains the rules. But the context object

const context = {
  hotTemp: 20,
  city: 'Halifax',
  apiKey: 'XXXX',
  units: 'metric',
};

does not seem to match the rules:

    path: 'main.temp',
    is: {
      type: 'number',
      minimum: '{{hotTemp}}',
    },

fhirter avatar Aug 21 '24 14:08 fhirter