Skip to content

refactor(server): migrate to zod schemas (1/x)#26427

Closed
timonrieger wants to merge 15 commits intomainfrom
zod/1
Closed

refactor(server): migrate to zod schemas (1/x)#26427
timonrieger wants to merge 15 commits intomainfrom
zod/1

Conversation

@timonrieger
Copy link
Collaborator

@timonrieger timonrieger commented Feb 21, 2026

this is the first PR implementing the proposal to migrate away from decorator based dtos to zod schemas. It includes the library setup/integration, test fixes and first dto migration batch.

this PR won't go into detail on the why. Please refer to the discord discussion and #26172.

Note 1: since the migration won't be done in one go, I had to do some limbo due to having to support both approaches now. I have marked them below in my review. They are just temporary and will be removed/cleaned up once the migration is complete.

Note 2: The PR got bigger than I like but it was not feasible without spending more time doing this limbo. The issue is that one dto must either be defined by either the decorator OR zod approach, but never in both (otherwise causing duplicates, weird renaming juggles). I worked myself through the schemas starting from the UserResponseDto and migrating all direct and indirect inheritor dtos.

Note 3: The primary implementation limitation I set for this is to keep the api generally backwards compatible. See the references for details. Note however that for obvious properties (e.g. counts, uuids) constraints might have been set (e.g. counts are nonnegative). Technically they are breaking yes, but they would have been rejected by the server anyways or are unreasonable, anyways.

@immich-push-o-matic
Copy link

immich-push-o-matic bot commented Feb 21, 2026

Label error. Requires exactly 1 of: changelog:.*. Found: 📱mobile, 🖥️web, 🗄️server, preview. A maintainer will add the required label.

@github-actions
Copy link
Contributor

Deploying preview environment to https://pr-26427.preview.internal.immich.build/

@timonrieger timonrieger marked this pull request as ready for review February 22, 2026 16:27
@timonrieger timonrieger requested review from jrasm91 and removed request for danieldietzler and shenlong-tanwen February 22, 2026 16:27
@timonrieger timonrieger marked this pull request as draft February 22, 2026 22:21
@timonrieger
Copy link
Collaborator Author

Doing a full migration PR and some git history cleaning for easier rebases

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant