Gentime Settings
You are able to control certain aspects of the Nexus Prisma code generation.
Usage
Create a configuration file named any of:
nexusPrisma.ts / nexus-prisma.ts / nexus_prisma.ts
In one of the following directories:
Project Root – The directory containing your project's package.json. Example:
├── nexus-prisma.ts └── package.json
Primsa Directory – The directory containing your Prisma schema. Example:
├── prisma/nexus-prisma.ts └── package.json
If you have not already, install
ts-node
whichnexus-prisma
will use to read your configuration module.Import the settings singleton and make your desired changes. Example:
import { settings } from 'nexus-prisma/generator'settings({projectIdIntToGraphQL: 'ID',})
Reference
projectIdIntToGraphQL: 'ID' | 'Int'
@default
Int
@summary
Map Prisma model fields of typeInt
with attribute@id
toID
orInt
.
jsdocPropagationDefault?: 'none' | 'guide'
@default
'guide'
@summary
Nexus Prisma will project your Prisma schema field/model/enum documentation into JSDoc of the generated Nexus Prisma API.
This setting controls what Nexus Prisma should do when you have not written documentation in your Prisma Schema for a field/model/enum.
The following modes are as follows:
'none'
In this mode, no default JSDoc will be written.
'guide'
In this mode, guide content into your JSDoc that looks something like the following:
* ### ️⚠️ You have not writen documentation for ${thisItem} * Replace this default advisory JSDoc with your own documentation about ${thisItem} * by documenting it in your Prisma schema. For example: * ... * ... * ...
docPropagation.JSDoc: boolean
@default
true
@summary
Should Prisma Schema docs propagate as JSDoc?
docPropagation.GraphQLDocs: boolean
@default
true
@summary
Should Prisma Schema docs propagate as GraphQL docs?@remarks
When this is disabled it will force.description
property to beundefined
. This is for convenience, allowing you to avoid post-generation data manipulation or consumption contortions.
Prisma String @id fields project as GraphQL ID fields
All String
fields with @id
attribute in your Prisma Schema get projected as GraphQL ID
types rather than String
types.
model User { id String @id}
import { User } from 'nexus-prisma'import { objectType } from 'nexus'
objectType({ name: User.$name description: User.$description definition(t) { t.field(User.id) }})
type User { id: ID}