mirror of
https://github.com/immich-app/immich.git
synced 2026-05-24 16:42:30 -04:00
refactor(server)!: structured validation error responses (#28204)
* refactor(server)!: structured validation error responses * refactor(server): clarify comment on removing duplicate HTTP response fields * enhance validation error tests * make path and message required * fmt * fix e2e test * fmt * feat: enhance error handling in getServerErrorMessage function
This commit is contained in:
@@ -78,9 +78,9 @@ describe(UserAdminController.name, () => {
|
||||
.send(dto);
|
||||
expect(status).toBe(400);
|
||||
expect(body).toEqual(
|
||||
errorDto.badRequest(
|
||||
expect.arrayContaining(['[quotaSizeInBytes] Invalid input: expected int, received number']),
|
||||
),
|
||||
errorDto.validationError([
|
||||
{ path: ['quotaSizeInBytes'], message: 'Invalid input: expected int, received number' },
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -98,9 +98,9 @@ describe(UserAdminController.name, () => {
|
||||
.send(dto);
|
||||
expect(status).toBe(400);
|
||||
expect(body).toEqual(
|
||||
errorDto.badRequest(
|
||||
expect.arrayContaining(['[quotaSizeInBytes] Invalid input: expected int, received number']),
|
||||
),
|
||||
errorDto.validationError([
|
||||
{ path: ['quotaSizeInBytes'], message: 'Invalid input: expected int, received number' },
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -125,9 +125,9 @@ describe(UserAdminController.name, () => {
|
||||
.send({ quotaSizeInBytes: 1.2 });
|
||||
expect(status).toBe(400);
|
||||
expect(body).toEqual(
|
||||
errorDto.badRequest(
|
||||
expect.arrayContaining(['[quotaSizeInBytes] Invalid input: expected int, received number']),
|
||||
),
|
||||
errorDto.validationError([
|
||||
{ path: ['quotaSizeInBytes'], message: 'Invalid input: expected int, received number' },
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user