From 6893727d102c40dc845954fdbcb41c044e748013 Mon Sep 17 00:00:00 2001 From: NOlbert <45466413+N-Olbert@users.noreply.github.com> Date: Tue, 11 Nov 2025 23:19:10 +0100 Subject: [PATCH 1/3] Migration docs for PR 8504 --- .../v16/migrating/migrate-from-15-to-16.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md index d19977fbe14..44b72b52d2c 100644 --- a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md +++ b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md @@ -212,6 +212,21 @@ In addition, the default output for such errors has been standardized: earlier, } ``` +## Generic `ID`-attribute now infers the actual GraphQL type name + +Previously, `[ID]` used the CLR type name (`nameof(Type)`), even when a different GraphQL name was configured via `[GraphQLName]` or `descriptor.Name()`. +It now uses the actual GraphQL type name if one is defined, f. e.: + +```csharp +[GraphQLName("Book")] +public sealed class BookDTO { } + +[ID] // uses "Book" now, not "BookDTO" anymore +``` + +Note that this change implies that all type parameters of the generic `ID`-attribute must now be valid GraphQL types. +If you need the old behavior, use can still use the non-generic `ID`-attribute and set the type name explicitly: `[ID("BookDTO")]`. + ## DescriptorAttribute attributeProvider is nullable Previously the `TryConfigure` or `OnConfigure` methods carried a non-nullable parameter of the member the descriptor attribute was annotated to. With the new source generator we moved away from pure reflection based APIs. This means that when you use the source generator From a97d050e0265e9e6df7112705e9f81af69e0ebaf Mon Sep 17 00:00:00 2001 From: NOlbert <45466413+N-Olbert@users.noreply.github.com> Date: Tue, 11 Nov 2025 23:21:11 +0100 Subject: [PATCH 2/3] Typo --- .../docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md index 44b72b52d2c..7ab93554e18 100644 --- a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md +++ b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md @@ -214,7 +214,7 @@ In addition, the default output for such errors has been standardized: earlier, ## Generic `ID`-attribute now infers the actual GraphQL type name -Previously, `[ID]` used the CLR type name (`nameof(Type)`), even when a different GraphQL name was configured via `[GraphQLName]` or `descriptor.Name()`. +Previously, `[ID]` used the CLR type name (`nameof(Type)`), even when a different GraphQL type name was configured via `[GraphQLName]` or `descriptor.Name()`. It now uses the actual GraphQL type name if one is defined, f. e.: ```csharp From ae10bbc0c03bd3c680d3e3e928246b222f9638b7 Mon Sep 17 00:00:00 2001 From: NOlbert <45466413+N-Olbert@users.noreply.github.com> Date: Wed, 12 Nov 2025 20:01:58 +0100 Subject: [PATCH 3/3] Applied comments from review --- .../v16/migrating/migrate-from-15-to-16.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md index 7ab93554e18..1bb2177a3af 100644 --- a/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md +++ b/website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md @@ -215,11 +215,17 @@ In addition, the default output for such errors has been standardized: earlier, ## Generic `ID`-attribute now infers the actual GraphQL type name Previously, `[ID]` used the CLR type name (`nameof(Type)`), even when a different GraphQL type name was configured via `[GraphQLName]` or `descriptor.Name()`. -It now uses the actual GraphQL type name if one is defined, f. e.: +It now uses the actual GraphQL type name if one is defined, for example: ```csharp [GraphQLName("Book")] -public sealed class BookDTO { } +public sealed class BookDTO +{ + [ID] + public int Id { get; set; } + + public string Title { get; set; } +} [ID] // uses "Book" now, not "BookDTO" anymore ```