feat(client-generator-ts): [breaking] add support for mapped enums#28180
Merged
feat(client-generator-ts): [breaking] add support for mapped enums#28180
Conversation
Contributor
size-limit report 📦
|
Contributor
|
Client memory tests, node 24, library: ✅ Success |
FGoessler
approved these changes
Sep 30, 2025
This was referenced Oct 1, 2025
aqrln
pushed a commit
that referenced
this pull request
Nov 17, 2025
…28180) **Breaking change** This PR: - closes #8446 - closes #273 - closes [TML-1438](https://linear.app/prisma-company/issue/TML-1438/add-support-for-mapped-enums) - translates PSL mapped enums into TS mapped enums ## Before this PR This Prisma enum definition ```prisma enum PaymentProvider { MixplatSMS @Map("mixplat/sms") InternalToken @Map("internal/token") Offline @Map("offline") @@Map("payment_provider") } ``` would result into this TypeScript value ```typescript export const PaymentProvider: { MixplatSMS: 'MixplatSMS', InternalToken: 'InternalToken', Offline: 'Offline' } ``` ## After this PR This Prisma enum definition (same as the above one) ```prisma enum PaymentProvider { MixplatSMS @Map("mixplat/sms") InternalToken @Map("internal/token") Offline @Map("offline") @@Map("payment_provider") } ``` would result into this TypeScript value ``` export const PaymentProvider: { MixplatSMS: 'mixplat/sms' InternalToken: 'internal/token' Offline: 'offline' } ``` /integration --------- Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
aqrln
pushed a commit
that referenced
this pull request
Nov 17, 2025
…28180) **Breaking change** This PR: - closes #8446 - closes #273 - closes [TML-1438](https://linear.app/prisma-company/issue/TML-1438/add-support-for-mapped-enums) - translates PSL mapped enums into TS mapped enums ## Before this PR This Prisma enum definition ```prisma enum PaymentProvider { MixplatSMS @Map("mixplat/sms") InternalToken @Map("internal/token") Offline @Map("offline") @@Map("payment_provider") } ``` would result into this TypeScript value ```typescript export const PaymentProvider: { MixplatSMS: 'MixplatSMS', InternalToken: 'InternalToken', Offline: 'Offline' } ``` ## After this PR This Prisma enum definition (same as the above one) ```prisma enum PaymentProvider { MixplatSMS @Map("mixplat/sms") InternalToken @Map("internal/token") Offline @Map("offline") @@Map("payment_provider") } ``` would result into this TypeScript value ``` export const PaymentProvider: { MixplatSMS: 'mixplat/sms' InternalToken: 'internal/token' Offline: 'offline' } ``` /integration --------- Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
aqrln
pushed a commit
that referenced
this pull request
Nov 17, 2025
…28180) **Breaking change** This PR: - closes #8446 - closes #273 - closes [TML-1438](https://linear.app/prisma-company/issue/TML-1438/add-support-for-mapped-enums) - translates PSL mapped enums into TS mapped enums ## Before this PR This Prisma enum definition ```prisma enum PaymentProvider { MixplatSMS @Map("mixplat/sms") InternalToken @Map("internal/token") Offline @Map("offline") @@Map("payment_provider") } ``` would result into this TypeScript value ```typescript export const PaymentProvider: { MixplatSMS: 'MixplatSMS', InternalToken: 'InternalToken', Offline: 'Offline' } ``` ## After this PR This Prisma enum definition (same as the above one) ```prisma enum PaymentProvider { MixplatSMS @Map("mixplat/sms") InternalToken @Map("internal/token") Offline @Map("offline") @@Map("payment_provider") } ``` would result into this TypeScript value ``` export const PaymentProvider: { MixplatSMS: 'mixplat/sms' InternalToken: 'internal/token' Offline: 'offline' } ``` /integration --------- Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
|
I can still reproduce this issue using Prisma 7.1.0. The type generated is correct, it has good mapping values, but when in execution time, the value is not mapped. I mean I should get mixplat/sms and i'm getting MixplatSMS as value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
This PR:
enumstring assignments #273Before this PR
This Prisma enum definition
would result into this TypeScript value
After this PR
This Prisma enum definition (same as the above one)
would result into this TypeScript value
/integration