Skip to content

Commit f55c9ff

Browse files
authored
Migration docs for PR 8504 (#8889)
1 parent 27b3d57 commit f55c9ff

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

website/src/docs/hotchocolate/v16/migrating/migrate-from-15-to-16.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,27 @@ In addition, the default output for such errors has been standardized: earlier,
212212
}
213213
```
214214

215+
## Generic `ID<Type>`-attribute now infers the actual GraphQL type name
216+
217+
Previously, `[ID<Type>]` used the CLR type name (`nameof(Type)`), even when a different GraphQL type name was configured via `[GraphQLName]` or `descriptor.Name()`.
218+
It now uses the actual GraphQL type name if one is defined, for example:
219+
220+
```csharp
221+
[GraphQLName("Book")]
222+
public sealed class BookDTO
223+
{
224+
[ID]
225+
public int Id { get; set; }
226+
227+
public string Title { get; set; }
228+
}
229+
230+
[ID<BookDTO>] // uses "Book" now, not "BookDTO" anymore
231+
```
232+
233+
Note that this change implies that all type parameters of the generic `ID<Type>`-attribute must now be valid GraphQL types.
234+
If you need the old behavior, use can still use the non-generic `ID`-attribute and set the type name explicitly: `[ID("BookDTO")]`.
235+
215236
## DescriptorAttribute attributeProvider is nullable
216237

217238
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

0 commit comments

Comments
 (0)