diff --git a/website/src/components/articles/doc-article-community.tsx b/website/src/components/articles/doc-article-community.tsx index f3b6aa1b3cb..13e4f901024 100644 --- a/website/src/components/articles/doc-article-community.tsx +++ b/website/src/components/articles/doc-article-community.tsx @@ -22,7 +22,7 @@ export const DocArticleCommunity: FC = ({ originPath, }) => { const metadata = data.site!.siteMetadata!; - const docPath = `${metadata.repositoryUrl!}/blob/master/website/src/docs/${originPath}`; + const docPath = `${metadata.repositoryUrl!}/blob/main/website/src/docs/${originPath}`; return ( diff --git a/website/src/docs/hotchocolate/v14/defining-a-schema/relay.md b/website/src/docs/hotchocolate/v14/defining-a-schema/relay.md index cdfeae49e62..945cc73087e 100644 --- a/website/src/docs/hotchocolate/v14/defining-a-schema/relay.md +++ b/website/src/docs/hotchocolate/v14/defining-a-schema/relay.md @@ -167,27 +167,29 @@ The approach of either implementation-first or code-first can be used in conjunc ## Id Serializer -Unique (or global) Ids are generated using the `IIdSerializer`. We can access it like any other service and use it to serialize or deserialize global Ids ourselves. +Unique (or global) Ids are generated using the `DefaultNodeIdSerializer`. We can access it like any other service and use it to serialize or deserialize global Ids ourselves. ```csharp public class Query { - public string Example(IIdSerializer serializer) + public string Example(DefaultNodeIdSerializer serializer) { - string serializedId = serializer.Serialize(null, "Product", "123"); + string serializedId = serializer.Format("Product", "123"); - IdValue deserializedIdValue = serializer.Deserialize(serializedId); - object deserializedId = deserializedIdValue.Value; + NodeId deserializedIdValue = serializer.Parse(serializedId, typeof(Int32)); + object deserializedId = deserializedIdValue.InternalId; // Omitted code for brevity } } ``` -The `Serialize()` method takes the schema name as a first argument, followed by the type name and lastly the actual Id. +The `Format()` method takes the type name as a first argument, followed by the actual Id. [Learn more about accessing services](/docs/hotchocolate/v14/fetching-data/resolvers#injecting-services) +> Note: `OptimizedNodeIdSerializer` and `LegacyNodeIdSerializer` can also be used in the above example as serializers. + # Complex Ids In certain situations, you may need to use complex identifiers for your data models, rather than simple integers or strings. HotChocolate provides support for complex IDs by allowing you to define custom ID types, which can be used in your GraphQL schema. diff --git a/website/src/docs/hotchocolate/v15/defining-a-schema/relay.md b/website/src/docs/hotchocolate/v15/defining-a-schema/relay.md index 350f0ea8318..7742edb7ccd 100644 --- a/website/src/docs/hotchocolate/v15/defining-a-schema/relay.md +++ b/website/src/docs/hotchocolate/v15/defining-a-schema/relay.md @@ -167,27 +167,30 @@ The approach of either implementation-first or code-first can be used in conjunc ## Id Serializer -Unique (or global) Ids are generated using the `IIdSerializer`. We can access it like any other service and use it to serialize or deserialize global Ids ourselves. +Unique (or global) Ids are generated using the `DefaultNodeIdSerializer`. We can access it like any other service and use it to serialize or deserialize global Ids ourselves. + ```csharp public class Query { public string Example(IIdSerializer serializer) { - string serializedId = serializer.Serialize(null, "Product", "123"); + string serializedId = serializer.Format("Product", "123"); - IdValue deserializedIdValue = serializer.Deserialize(serializedId); - object deserializedId = deserializedIdValue.Value; + NodeId deserializedIdValue = serializer.Parse(serializedId, typeof(Int32)); + object deserializedId = deserializedIdValue.InternalId; // Omitted code for brevity } } ``` -The `Serialize()` method takes the schema name as a first argument, followed by the type name and lastly the actual Id. +The `Format()` method takes the type name as a first argument, followed by the actual Id. [Learn more about accessing services](/docs/hotchocolate/v15/fetching-data/resolvers#injecting-services) +> Note: `OptimizedNodeIdSerializer` and `LegacyNodeIdSerializer` can also be used in the above example as serializers. + # Complex Ids In certain situations, you may need to use complex identifiers for your data models, rather than simple integers or strings. HotChocolate provides support for complex IDs by allowing you to define custom ID types, which can be used in your GraphQL schema.