Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation #181

Open
tschirky opened this issue Nov 22, 2023 · 0 comments
Open

Improve documentation #181

tschirky opened this issue Nov 22, 2023 · 0 comments

Comments

@tschirky
Copy link

I think my struggles with the advanced filtering implementation are worth sharing here to maybe consider improving the documentation. Still, this is not supposed to be any blame regarding the general implementation, because we really appreciate this neat little simulator!

Here's a draft:

Advanced Filtering

Every advanced filter config consists of three properties.

operatorType: any in [NumberGreaterThan, NumberGreaterThanOrEquals, NumberLessThan, NumberLessThanOrEquals, NumberIn, NumberNotIn, BoolEquals, StringContains, StringBeginsWith, StringEndsWith, StringIn, StringNotIn]

key: name of a property of the event to filter for. Important: the property name must start with a capital letter, even if the "real" property in the event (i.e. the JSON object) might not.

The third property depends on the operatorType.
For the following operator types (StringIn, StringNotIn, NumberIn and NumberNotIn), use the values property with an array of at most 5 values:

"filter": {
  "advancedFilters": [
    {
      "operatorType": "StringIn",
      "key": "Data.Key1",
      "values": ["value1", "value2" ]
    }
  ]
}

For all the other operator types, use the value property with a single value:

"filter": {
  "advancedFilters": [
    {
      "operatorType": "NumberGreaterThanOrEquals",
      "key": "Data.Key1",
      "value": 5
    }
  ]
}

The example given in the current README on the other hand is - if I'm not mistaken - wrong.
The operatorType StringContains does not work with an array of values but only with a value.

"filter": {
  "advancedFilters": [
    {
      "operatorType": "NumberGreaterThanOrEquals",
      "key": "Data.Key1",
      "value": 5
    },
    {
      "operatorType": "StringContains",
      "key": "Subject",
      "values": ["container1", "container2"]
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant