Add beginsWithAny search operator for array properties
C
Chester Booker
### Request a new search operator for
beginsWithAny
, with semantics such as:{
"operator": "beginsWithAny",
"property": "myArrayProperty",
"value": ["prefix1", "prefix2"]
}
This would return entities where at least one element of
myArrayProperty
starts with any of the provided prefixes. i.e. prefix1-example
or prefix2-example
would match.## Motivation / Use cases:
- Improved path matching across multiple sources. (e.g., issue exists on file /abc/def/issue.txtand team A is responsible for all issues on path/abc/def/.
- Build Scorecard rules that validate naming conventions on arrays of strings (e.g., Kubernetes labels, GitHub topics) without needing extra calculated properties.
- Simplify complex queries that currently require preprocessing or additional properties just to support prefix checks on arrays.
## What Port currently supports:
- beginsWith/doesNotBeginsWithfor checking whether a string/number property starts with a given value.
- containsAnyfor checking whether any of the specified strings exist in a target array. https://docs.port.io/search-and-query/operators/comparison-operators/#containsany
However, no operator allows checking whether any element in an array property begins with a given prefix (or one of several prefixes)
Therefore, this proposed operator would complement the existing
beginsWith
and containsAny
operators and make array-based filtering more expressive and consistent with current string/number capabilities.## Extra scope:
I'm sure
endsWithAny
would also be appreciated by others, but not needed for my use cases.{
"operator": "endsWithAny",
"property": "myArrayProperty",
"value": ["suffix1", "suffix2"]
}