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-designopenapitypesdocumentation
Use constructor references, not string literals, for OpenAPI property types
In API schema decorators pass the actual type constructor (String, Number, Boolean) rather than a string literal like 'string', which is interpreted as a literal value.
PR: vinify-backend · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | @ApiProperty({ type: 'string' }) // 'string' is a literal, like 'my-string' |
| 2 | public code!: string; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | @ApiProperty({ type: String }) |
| 2 | public code!: string; |
Explanation (EN)
Objašnjenje (HR)