Skip to content

Commit 3a63656

Browse files
committed
fix(plugins/prisma): add missing enum value documentations in generated prisma schema
1 parent 7a15948 commit 3a63656

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/schema/src/plugins/prisma/schema-generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ export class PrismaSchemaGenerator {
738738
const nonPrismaAttributes = field.attributes.filter((attr) => attr.decl.ref && !this.isPrismaAttribute(attr));
739739

740740
const documentations = nonPrismaAttributes.map((attr) => '/// ' + this.zModelGenerator.generate(attr));
741-
_enum.addField(field.name, attributes, documentations);
741+
_enum.addField(field.name, attributes, documentations.concat(field.comments));
742742
}
743743
}
744744

packages/schema/tests/generator/prisma-generator.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ describe('Prisma generator test', () => {
223223
}
224224
225225
enum Role {
226+
/// Admin role documentation line 1
227+
/// Admin role documentation line 2
226228
ADMIN @map('admin')
227229
CUSTOMER @map('customer')
228230
@@map('_Role')
@@ -251,6 +253,9 @@ describe('Prisma generator test', () => {
251253
expect(content).toContain(`@@map("_Role")`);
252254
expect(content).toContain(`@map("admin")`);
253255
expect(content).toContain(`@map("customer")`);
256+
expect(content).toContain('/// Admin role documentation line 1\n' +
257+
' /// Admin role documentation line 2\n' +
258+
' ADMIN');
254259
});
255260

256261
it('attribute passthrough', async () => {

0 commit comments

Comments
 (0)