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..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 @@ -212,6 +212,27 @@ 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, for example: + +```csharp +[GraphQLName("Book")] +public sealed class BookDTO +{ + [ID] + public int Id { get; set; } + + public string Title { get; set; } +} + +[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