Skip to content

Have you considered using jsonata? #13

Description

@iiian

You might be able to escape some of the weight of carrying around everything in JSON by transitioning to jsonata.

In your example, you use

rule = {
    "name": "basic_rule",
    "conditions": {
        "all": [
            {
                # JSONPath support
                "path": "$.person.name",
                "operator": "equal",
                "value": "Lionel"
            },
            {
                "path": "$.person.last_name",
                "operator": "equal",
                "value": "Messi"
            }
        ]
    }
}

if you were to use the jsonata-python project as part of your engine, you could reduce these to

rule = {
  "name": "basic_rule",
  "conditions": {
    "all": [
      "$.person.name == \"Lionel\",
      "$.person.last_name == \"Messi\""
    ]
  }

or even

rule = {
  "name": ...
  "conditions": "$.person.name == \"Lionel\" and $.person.last_name == \"Messi\""
}

Feel free to close this issue, as it's completely unsolicited input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions