Skip to content

feat(api): BA-114 standardize API validation error responses with stable error code and field details - #1044

Open
ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/validation-errors-1027
Open

ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/validation-errors-1027

Conversation

@ranjeetprabhatedu-dotcom

Copy link
Copy Markdown

Summary

This PR implements BA-114 to standardize API validation error responses across all endpoints.

  • Implements validationExceptionFactory and formatValidationErrors in app.controller.ts to transform class-validator ValidationError collections into a structured format with stable code: 'VALIDATION_FAILED'.
  • Includes detailed per-field violation information (field, value, constraints) in the response payload.
  • Wires validationExceptionFactory into the global ValidationPipe in main.ts.
  • Adds comprehensive unit tests in app.controller.spec.ts covering validation error transformation, stable error code verification, and integration with ValidationPipe.
  • Scoped strictly to the 3 allowlisted files:
    • BackendAcademy/src/main.ts
    • BackendAcademy/src/app.controller.ts
    • BackendAcademy/src/app.controller.spec.ts

Closes #1027

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BA-114 — Standardize API validation error responses

1 participant