Skip to content

Commit e3b95b9

Browse files
Copilotxperiandri
andauthored
docs: finalize ObjectListFilter clarifications
Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent daa682f commit e3b95b9

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ This filter is mapped by the middleware into the `ObjectListFilter` discriminate
401401

402402
- `Equals`, `StartsWith`, `EndsWith`, and `Contains` now carry a comparer in the public discriminated union.
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 the filtered field is a string and you construct the DU cases directly, pass a `StringComparer` instance in that comparer slot: `StringComparer.Ordinal` for case-sensitive matching and `StringComparer.OrdinalIgnoreCase` for case-insensitive matching.
404+
- 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.
405405
- The built-in case-sensitive operators (`===`, `=@@`, `@@=`, `@=@`) still use the default comparer behavior for you.
406406
- `Contains` is also used for collection membership checks, so the wrapped value type inside `FieldFilter<_>` stays `System.IComparable` instead of being limited to `string`.
407407
- If you were previously constructing `Equals`, `StartsWith`, `EndsWith`, or `Contains` directly, update those call sites to provide the comparer argument explicitly.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ type FieldFilter<'Val> = { FieldName : string; Value : 'Val }
1111
/// A filter definition for an object list.
1212
/// </summary>
1313
/// <remarks>
14-
/// String-based filters can carry a comparer. When the comparer is omitted internally by the
15-
/// default case-sensitive operators, that value is handled the same as `StringComparer.Ordinal`.
14+
/// String-based filters can carry a comparer. When the comparer is not provided by the default
15+
/// case-sensitive operators, the behavior is equivalent to using `StringComparer.Ordinal`.
1616
/// `StringComparer.OrdinalIgnoreCase` enables case-insensitive matching.
1717
/// When filters are provided through GraphQL input, lowercase string suffixes are interpreted
1818
/// as case-insensitive and capitalized suffixes are interpreted as case-sensitive.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ let ObjectListFilterType : InputCustomDefinition<ObjectListFilter> = {
185185
" "
186186
[
187187
"The `ObjectListFilter` value represents field filters for object lists."
188-
"Lowercase string suffixes such as `_starts_with`/`_sw`, `_ends_with`/`_ew`, `_contains`, and `_equals`/`_eq` are case-insensitive when applied to string fields."
189-
"Capitalized string suffixes such as `_Starts_With`/`_SW`, `_Ends_With`/`_EW`, `_Contains`, and `_Equals`/`_EQ` are case-sensitive when applied to string fields."
188+
"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."
189+
"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."
191191
])
192192
CoerceInput =

0 commit comments

Comments
 (0)