Skip to main content

Global validation pipeline

MUZE uses NestJS’s ValidationPipe applied globally in main.ts:

DTO pattern

All request bodies are validated against DTO classes using class-validator decorators:

Validation rules by type

String fields

Numeric fields

Enum fields

Date fields

Nested objects

Arrays

Query parameter validation

Query parameters are also validated via DTOs:

File upload validation

File uploads use multipart/form-data and are validated at the service level:
  • File type checking (CSV for imports, PDF for documents)
  • File size limits enforced by the 20MB Express body limit
  • CSV column headers validated against expected schema
  • Invalid rows are skipped with error reporting (imports are partial-failure tolerant)

Error response format

Validation errors return a consistent 400 response:

What is not validated