pantharshit00 / prisma-docs-generator

Prisma generator for automatically generating documentation reference from the Prisma schema.
MIT License
578 stars 27 forks source link

Must enable 'extendedIndexes` preview feature when trying to serve documents #61

Closed nklisch closed 1 year ago

nklisch commented 1 year ago

It seems you are using a 3.x of Prisma, as it considers extendedIndexes a preview feature. I am using 4.x Prisma and this is no longer a preview feature. Output of generating the prisma client and docs and then trying to serve:

nathan@Server-Box:~/dev/alliance/ams$ npx prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma

✔ Generated Prisma Client (4.8.0 | library) to ./prisma/client in 1.08s

✔ Generated Prisma Docs Generator to ./prisma/docs in 568ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client

import { PrismaClient } from './prisma/client'
const prisma = new PrismaClient()

warn Versions of prisma@4.1.1 and @prisma/client@4.8.0 don't match.
This might lead to unexpected behavior.
Please make sure they have the same version.

nathan@Server-Box:~/dev/alliance/ams$ npx prisma-docs-generator serve
Error: Get DMMF: Schema parsing
error: Error parsing attribute "@@index": You must enable `extendedIndexes` preview feature to be able to define the index type.
  -->  schema.prisma:537
   | 
536 | 
537 |   @@index([id], type: Hash)
   | 
error: Error parsing attribute "@@index": You must enable `extendedIndexes` preview feature to be able to define the index type.
  -->  schema.prisma:538
   | 
537 |   @@index([id], type: Hash)
538 |   @@index([sid], type: Hash)
   | 

Validation Error Count: 2

Prisma CLI Version : 3.15.2
    at /home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/dist/engine-commands/getDmmf.js:125:14
    at /home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/node_modules/fp-ts/lib/Either.js:268:52
    at pipe (/home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/node_modules/fp-ts/lib/function.js:288:23)
    at /home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/dist/engine-commands/getDmmf.js:115:50
    at e.run (/home/nathan/dev/alliance/ams/node_modules/ts-pattern/dist/index.cjs:1:4927)
    at e.otherwise (/home/nathan/dev/alliance/ams/node_modules/ts-pattern/dist/index.cjs:1:4570)
    at getDmmfNodeAPI (/home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/dist/engine-commands/getDmmf.js:128:6)
    at async getDMMF (/home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/dist/engine-commands/getDmmf.js:53:16)
    at async getGenerators (/home/nathan/dev/alliance/ams/node_modules/@prisma/sdk/dist/get-generators/getGenerators.js:107:16)
    at async execute (/home/nathan/dev/alliance/ams/node_modules/prisma-docs-generator/dist/cli.js:68:26)

It may be wise to configure the CLI version used based on the project's Prisma version used, if possible.

pantharshit00 commented 1 year ago

This should be addressed in the latest release: https://github.com/pantharshit00/prisma-docs-generator/releases/tag/v0.6.0. Sorry for the delay here.