json-api-dotnet/JsonApiDotNetCore

Add [DisallowNull] on id parameters

bkoelman opened this issue · 0 comments

Controllers, resource services, repositories, repository accessors, and IQueryLayerComposer should be annotated with [DisallowNull] for method parameters named id. While it can be null in the resource type itself (to support zero values), they should never be for incoming requests.

Adding this annotation produces a compiler warning when called directly from custom code.

We can't add the notnull constraint on TId, because that breaks the contract with IIdentifiable<TId>.