Cauen / prisma-generator-pothos-codegen

The fastest way to create a fully customizable CRUD Graphql API from Prisma Schema.
https://www.npmjs.com/package/prisma-generator-pothos-codegen
95 stars 16 forks source link

Linebreaks cause incorrect descriptions to be generated #70

Closed m1212e closed 2 months ago

m1212e commented 4 months ago

When using multi line docs on models like here:

/// A token which can be used to grant one time access to something in the app
/// e.g. confirming an email, resetting a password
model Token {
  id        String   @id @default(uuid())
  /// @Pothos.omit()
  tokenHash String
...

The output descriptions contains a line break:

export const TokenObject = definePrismaObject('Token', {
  description: 'A token which can be used to grant one time access to something in the app
e.g. confirming an email, resetting a password',
  findUnique: ({ id }) => ({ id }),
  fields: (t) => ({
    id: t.field(TokenIdFieldObject),
    tokenHash: t.field(TokenTokenHashFieldObject),
    expiresAt

which is invalid. Using ` template string escape allows for multi line strings as they are generated, would also solve https://github.com/Cauen/prisma-generator-pothos-codegen/issues/69

Cauen commented 2 months ago

Sorry for the delay in responding, busy days D:

Fixed in new version 0.6.5 🗡️ Thanks for helping making this better 🚀