Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [DisallowNull] on id parameters #1571

Closed
bkoelman opened this issue Jun 25, 2024 · 0 comments · Fixed by #1583
Closed

Add [DisallowNull] on id parameters #1571

bkoelman opened this issue Jun 25, 2024 · 0 comments · Fixed by #1583

Comments

@bkoelman
Copy link
Member

bkoelman commented Jun 25, 2024

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>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant