From d11de90c776cfefc3bef0e5d8175dc77e0940b63 Mon Sep 17 00:00:00 2001 From: Richard Beauchamp Date: Thu, 1 Sep 2022 01:40:20 -0700 Subject: [PATCH] Fixed grammar and spelling in the sorting doc (#5362) --- .../hotchocolate/fetching-data/sorting.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/website/src/docs/hotchocolate/fetching-data/sorting.md b/website/src/docs/hotchocolate/fetching-data/sorting.md index 86d3f108905..712bfa3de85 100644 --- a/website/src/docs/hotchocolate/fetching-data/sorting.md +++ b/website/src/docs/hotchocolate/fetching-data/sorting.md @@ -6,11 +6,11 @@ import { ExampleTabs, Annotation, Code, Schema } from "../../../components/mdx/e # What is sorting -Ordering results of a query dynamically is a common case. With Hot Chocolate sorting, you can expose a sorting argument, that abstracts the complexity of ordering logic. -With little configuration your GraphQL API has sorting capabilities which translates to native database queries. +Ordering results of a query dynamically is a common case. With Hot Chocolate sorting, you can expose a sorting argument that abstracts the complexity of ordering logic. +With little configuration, your GraphQL API has sorting capabilities, which translates to native database queries. The default sort implementation translates sorting statements to expression trees that are applied to `IQueryable`. Hot Chocolate by default will inspect your .NET model and infer the possible filter operations from it. -Sorting uses `IQueryable` (`IEnumerable`) by default but you can also easily customize them to use other interfaces. +Sorting uses `IQueryable` (`IEnumerable`) by default, but you can also easily customize them to use other interfaces. The following type would yield the following sorting operation @@ -117,13 +117,13 @@ public class Query # Customization -Under the hood, sorting is based ontop of normal Hot Chocolate input types. You can easily customize them with a very familiar fluent interface. The sorting input types follow the same `descriptor` scheme as you are used to from the normal input types. Just extend the base class `SortInputType` and override the descriptor method. +Under the hood, sorting is based on top of normal Hot Chocolate input types. You can easily customize them with a very familiar fluent interface. The sorting input types follow the same `descriptor` scheme as you are used to from the normal input types. Just extend the base class `SortInputType` and override the descriptor method. `ISortInputTypeDescriptor` supports most of the methods of `IInputTypeDescriptor`. By default, operations are generated for all fields of the type. Members that are collections are skipped because you cannot order based on lists. -If you do want to specify the sorting types by yourself you can change this behavior with `BindFields`, `BindFieldsExplicitly` or `BindFieldsImplicitly`. +If you do want to specify the sorting types by yourself, you can change this behavior with `BindFields`, `BindFieldsExplicitly`, or `BindFieldsImplicitly`. When fields are bound implicitly, meaning sorting is added for all valid properties, you may want to hide a few fields. You can do this with `Ignore(x => Bar)`. -It is also possible to customize the GraphQL field of the operation further. You can change the name, add a description or directive. +It is also possible to customize the GraphQL field of the operation further. You can change the name or add a description or directive. ```csharp public class UserSortType : SortInputType @@ -136,7 +136,7 @@ public class UserSortType : SortInputType } ``` -If you want to change the sorting operations on a field, you need to declare you own operation enum type. +If you want to change the sorting operations on a field, you need to declare your own operation enum type. ```csharp {7} public class UserSortType : SortInputType @@ -177,7 +177,7 @@ enum AscOnlySortEnumType { } ``` -To apply this sorting type we just have to provide it to the `UseSorting` extension method with as the generic type argument. +To apply this sorting type, we just have to provide it to the `UseSorting` extension method as the generic type argument. @@ -220,13 +220,13 @@ public class Query # Sorting Conventions -If you want to change the behavior sorting globally, you want to create a convention for sorting. The sorting convention comes with a fluent interface that is close to a type descriptor. +If you want to change the behavior of sorting globally, you want to create a convention for sorting. The sorting convention comes with a fluent interface that is close to a type descriptor. ## Get Started -To use a sort convention you have to extend `SortConvention` and override the `Configure` method. Alternatively, you can directly configure the convention over the constructor argument. +To use a sort convention, you have to extend `SortConvention` and override the `Configure` method. Alternatively, you can directly configure the convention over the constructor argument. You then have to register your custom convention on the schema builder with `AddConvention`. -By default a new convention is empty. To add the default behaviour you have to add `AddDefaults`. +By default, a new convention is empty. To add the default behavior, you have to add `AddDefaults`. ```csharp public class CustomConvention @@ -246,7 +246,7 @@ services.AddGraphQLServer() x.AddDefaults())) ``` -Often you just want to extend the default behaviour of sorting. If this is the case, you can also use `SortConventionExtension` +Often you just want to extend the default behavior of sorting. If this is the case, you can also use `SortConventionExtension` ```csharp public class CustomConventionExtension @@ -292,7 +292,7 @@ type Query { ### SortInputType bindings -By default only the `string` type is bound explicitly. If you want to configure sorting globally you are free to bind additional types. +By default, only the `string` type is bound explicitly. If you want to configure sorting globally, you are free to bind additional types. **Configuration** @@ -382,7 +382,7 @@ When you build extensions for sorting, you may want to modify or extend the `Def ```csharp descriptor.ConfigureEnum( - x => x.Operaion(CustomOperations.NULL_FIRST).Name("NULL_FIRST)); + x => x.Operation(CustomOperations.NULL_FIRST).Name("NULL_FIRST)); ``` ```sdl @@ -395,12 +395,12 @@ enum SortEnumType { ### SortType -In case you want to change a specific sort type you can do this too. +In case you want to change a specific sort type, you can do this too. You can use `Configure()` to alter the configuration of a type. ```csharp descriptor.Configure( - x => x.Description("This is my custome description")); + x => x.Description("This is my custom description")); ``` ```sdl