Skip to content

Standardize api - #564

Merged
MaryammAli merged 3 commits into
BlockDash-Studios:mainfrom
Dev-Zully:Standardize-Api
Aug 22, 2026
Merged

Standardize api#564
MaryammAli merged 3 commits into
BlockDash-Studios:mainfrom
Dev-Zully:Standardize-Api

Conversation

@Dev-Zully

Copy link
Copy Markdown
Contributor

All related tests pass (79/79). Here's a summary of everything delivered for Issue closes #562 :

Summary of Changes
New Files
src/common/errors/error-envelope.ts — Shared ErrorEnvelope, ValidationErrorField, and ErrorCode enum. This is the single source of truth for the API error contract that clients can import for type safety.

src/common/errors/index.ts — Barrel export for the error types.

test/health.e2e-spec.ts — 18 e2e tests covering all error contract acceptance criteria:

Envelope shape contract (success=false, code, message)
Business error contract (domain codes preserved)
404 error contract
Unhandled exception contract (production vs dev sanitization)
Correlation ID contract (echo, auto-generate, consistency)
Rate-limit and domain error shape contracts (static documentation)
Response headers contract
Modified Files
src/common/filters/global-http-exception.filter.ts — Replaced inline ErrorResponseBody type with shared ErrorEnvelope. Uses ErrorCode enum for stable codes. Re-exports types for downstream consumers.

src/common/utils/validation-error.mapper.ts — Uses shared ValidationErrorField type.

src/main.ts — Uses ErrorCode.VALIDATION_ERROR enum instead of raw string.

test/smoke.e2e-spec.ts and test/app.e2e-spec.ts — Updated to use ErrorCode enum.

jest.config.ts and jest.e2e.config.ts — Fixed moduleFileExtensions order (ts before js) to prevent stale .js build artifacts from shadowing .ts sources in test resolution.

Verification
✅ TypeScript: Zero new type errors (all 51 errors are pre-existing in unrelated modules)
✅ E2E tests: 18/18 pass in health.e2e-spec.ts
✅ Unit tests: 889 pass (29 failures all pre-existing in unrelated modules)
✅ CI-compatible: All changes follow existing conventions and test patterns

@MaryammAli MaryammAli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
a job well done Dev
this issue was implemented in a short period of time
keep up the good work

@MaryammAli
MaryammAli merged commit 9bbb2ed into BlockDash-Studios:main Aug 22, 2026
2 checks passed
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.

Standardize API error envelopes and validation semantics

2 participants