prisma-nestjs-graphql
prisma-nestjs-graphql copied to clipboard
Is there a way to get Prisma comments to become Graphql descriptions?
Hi there! I was wondering if its possible to get the comments from the prisma schema (link to docs) to show up in the { description: } section?
Thanks
Paul
Triple comments of models will be copied to description property of ObjectType decorator, and will be visible in graphql schema. https://github.com/unlight/prisma-nestjs-graphql/blob/8896256a8e9eaf4422f2a1939889b8926b61f2a4/prisma/schema.prisma#L27-L29
Thanks unlight - that works perfectly!
Is there a way to get the comments on an enum in Prisma to become part of the valuesMap of the registerEnumType?
Eg.
enum Visability { /// A
VISABLE /// The item is visable
HIDDEN /// The item is hidden
}
result:
import { registerEnumType } from '@nestjs/graphql'
export enum Visability {
VISABLE = 'VISABLE',
HIDDEN = 'HIDDEN',
}
registerEnumType(Visability, {
name: 'Visability',
description: 'A',
valuesMap: {
VISABLE: {
description: 'The item is visable ',
},
HIDDEN: {
description: 'The item is hidden',
},
},
})
I'll check
Not possible, Prisma does not expose documentation (triple comments) for enum values.
@SynergyEvolved Can you create a feature request in http://github.com/prisma/prisma?
I have also opened an issue with the prisma team that comments get exposed on composite types. Apparently that was intended but just overlooked.
Resolved by https://github.com/prisma/prisma-engines/pull/4034 https://github.com/prisma/prisma-engines/pull/4037
Expected to be released with 4.16.0