Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Use supported Swagger schema types matching runtime fields
Match Swagger metadata to the actual field and library API; supported string schema types are valid.
Bad example
| 1 | @ApiProperty({ type: Number }) |
| 2 | public code!: string; |
Explanation (EN)
A schema type must describe the runtime field, rather than an unrelated constructor.
Objašnjenje (HR)
Good example
| 1 | @ApiProperty({ type: String }) |
| 2 | public code!: string; |
Explanation (EN)
The constructor matches a string field. A supported type: "string" declaration can also be correct.
Objašnjenje (HR)
Notes (EN)
Use a type declaration supported by the installed Swagger decorator API and inspect the generated OpenAPI schema.
Exceptions / Tradeoffs (EN)
NestJS Swagger supports type: String and schema type: "string" in its metadata. A literal allowed value belongs in enum/const where supported; a schema type name is not automatically a literal value.