Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP1stack specificStack: typescript
api-designopenapinull-safetydocumentation
Mark nullable response/request fields as nullable in the API schema
Every property that can be null in the TypeScript type must also declare nullability in its API schema decorator so generated docs and clients match runtime behavior.
PR: vinify-backend · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | @ApiProperty({ type: String }) |
| 2 | public label!: string | null; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | @ApiProperty({ type: String, nullable: true }) |
| 2 | public label!: string | null; |
Explanation (EN)
Objašnjenje (HR)