Skip to content

Valid $or Pattern fails RuleCompiler check #231

@InfamousBreeze

Description

@InfamousBreeze

Describe the bug

When using the RuleCompiler::check function to validate a rule pattern, I am receiving the following issue despite the pattern being valid:

Input:

{
    "$or": [{
        "title": [{
            "anything-but": ["Test"]
        }]
    }, {
        "severity": [{
            "numeric": ["=", 5]
        }]
    }]
}

Error message:

Unrecognized match type title at [Source: (String)"{ "$or": [{ "title": [{ "anything-but": ["Test"] }] }, { "severity": [{ "numeric": ["=", 5] }] }] }"; line: 3, column: 19]

Here "title" and "severity" are property keys of our JSON document and not reserved keywords but it seems to be hitting the validation logic at https://github.com/aws/event-ruler/blob/v1.8.1/src/main/software/amazon/event/ruler/RuleCompiler.java#L422 and failing.

To Reproduce

Invoke the check() function with the above payload

Expected behavior

check() function should return null as pattern is valid

Environment:

Java Version: JDK21
Ruler Package: 1.8.1

Additional context

We are internal SDO team

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions