Skip to content

Commit 18240a5

Browse files
Copilotxperiandri
andauthored
docs: align ObjectListFilter descriptions
Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent e3b95b9 commit 18240a5

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ query TestQuery {
361361
}
362362
```
363363

364-
For string filters, lowercase suffixes are case-insensitive (`name_starts_with`, `name_sw`, `name_equals`, `name_eq`), while capitalized suffixes are case-sensitive (`name_Starts_With`, `name_SW`, `name_Equals`, `name_EQ`).
364+
For string filters, lowercase suffixes are case-insensitive (`name_starts_with`, `name_sw`, `name_contains`, `name_equals`, `name_eq`), while capitalized suffixes are case-sensitive (`name_Starts_With`, `name_SW`, `name_Contains`, `name_Equals`, `name_EQ`). `contains`/`Contains` do not have shorthand aliases.
365365

366366
Also you can apply `not` operator like this:
367367

@@ -399,8 +399,9 @@ query TestQuery {
399399

400400
This filter is mapped by the middleware into the `ObjectListFilter` discriminated union, with cases such as `And`, `Or`, `Not`, `Equals`, `GreaterThan`, `GreaterThanOrEqual`, `LessThan`, `LessThanOrEqual`, `In`, `StartsWith`, `EndsWith`, `Contains`, `OfTypes`, and `FilterField`.
401401

402-
- `Equals`, `StartsWith`, `EndsWith`, and `Contains` now carry a comparer in the public discriminated union.
402+
- The comparer-aware cases in the public discriminated union are `Equals`, `StartsWith`, `EndsWith`, and `Contains`.
403403
- `Equals` and `Contains` keep the non-generic `System.Collections.IComparer` because they also support non-string comparable values in the public discriminated union.
404+
- When filters come from GraphQL input, suffix casing selects the string comparer automatically: lowercase suffixes use case-insensitive matching and capitalized suffixes use case-sensitive matching.
404405
- When the filtered field is a string and you construct the DU cases directly, pass a `StringComparer` instance in that comparer slot. `StringComparer` is accepted there because it also implements `System.Collections.IComparer`. Use `StringComparer.Ordinal` for case-sensitive matching and `StringComparer.OrdinalIgnoreCase` for case-insensitive matching.
405406
- The built-in case-sensitive operators (`===`, `=@@`, `@@=`, `@=@`) still use the default comparer behavior for you.
406407
- `Contains` is also used for collection membership checks, so the wrapped value type inside `FieldFilter<_>` stays `System.IComparable` instead of being limited to `string`.

src/FSharp.Data.GraphQL.Server.Middleware/SchemaDefinitions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ let ObjectListFilterType : InputCustomDefinition<ObjectListFilter> = {
184184
(String.concat
185185
" "
186186
[
187-
"The `ObjectListFilter` value represents field filters for object lists."
187+
"The ObjectListFilter value represents field filters for object lists."
188188
"Lowercase string suffixes such as `_starts_with`/`_sw`, `_ends_with`/`_ew`, `_contains` (no shorthand), and `_equals`/`_eq` are case-insensitive when applied to string fields."
189189
"Capitalized string suffixes such as `_Starts_With`/`_SW`, `_Ends_With`/`_EW`, `_Contains` (no shorthand), and `_Equals`/`_EQ` are case-sensitive when applied to string fields."
190190
"Comparison suffixes such as `_gt`, `_gte`, `_lt`, `_lte`, and `_in` are also supported."

0 commit comments

Comments
 (0)