premieroctet / next-admin

▲ Full-featured admin for Next.js and Prisma
https://next-admin.js.org
MIT License
282 stars 12 forks source link

[FEATURE] - Custom generator #414

Open foyarash opened 5 days ago

foyarash commented 5 days ago

Summary

Currently, generating we are using prisma-json-schema-generator to generate a JSON schema that we then have to import and pass into getNextAdminProps. This requires an extra dependency installation and an extra import of something that the user should not really care about.

The custom generator would allow us to add prisma-json-schema-generator as a dependency of next-admin, and to output the JSON schema directly in the node_modules (for example node_modules/.next-admin/json-schema.json). it would also allow us, in the future, to add some more customization to the JSON schema that would make the DMMF obsolete, since we could add all the DMMF information into the JSON schema.

Basic Example

generator nextAdmin {
  provider              = "@premieroctet/next-admin/generator"
}

Drawbacks

No response

Unresolved questions

No response

FacundoSpira commented 5 days ago

Really like this idea! If the DMMF is eventually deprecated, this can allow in the future to support different ORMs, for example Drizzle 👀

foyarash commented 5 days ago

Really like this idea! If the DMMF is eventually deprecated, this can allow in the future to support different ORMs, for example Drizzle 👀

Exactly, this is the ultimate goal of the lib, to be able to support every kind of ORM ! 😄