Skip to content

Commit

Permalink
fix: description type should not be null (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvauvillier authored Apr 23, 2021
1 parent 2f0023f commit cffc94d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/generator/models/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function renderTypeScriptDeclarationForEnum(enum_: DMMF.DatamodelEnum): string {
${jsDocForEnum(enum_)}
interface ${enum_.name} {
name: '${enum_.name}'
description: ${enum_.documentation ? `'${enum_.documentation}'` : 'null'}
description: ${enum_.documentation ? `'${enum_.documentation}'` : 'undefined'}
members: [${enum_.values.map((value) => `'${value.name}'`).join(', ')}]
}
`
Expand All @@ -132,7 +132,7 @@ function renderTypeScriptDeclarationForModel(model: DMMF.Model): string {
${jsDocForModel(model)}
interface ${model.name} {
$name: '${model.name}'
$description: ${model.documentation ? `'${model.documentation}'` : 'null'}
$description: ${model.documentation ? `'${model.documentation}'` : 'undefined'}
${renderTypeScriptDeclarationForModelFields(model)}
}
`
Expand Down
6 changes: 3 additions & 3 deletions src/generator/models/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type NexusObjectTypeDefConfiguration = Record<
}
// Metadata fields can be any of these
| string
| null
| undefined
>

/**
Expand All @@ -68,13 +68,13 @@ function createNexusObjectTypeDefConfigurations(dmmf: DMMF.Document): NexusObjec
.map((model) => {
return {
$name: model.name,
$description: model.documentation ?? null,
$description: model.documentation ?? undefined,
...chain(model.fields)
.map((field) => {
return {
name: field.name,
type: prismaFieldToNexusType(field),
description: field.documentation ?? null,
description: field.documentation ?? undefined,
}
})
.keyBy('name')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ declare namespace $Types {
*/
interface Foo {
name: 'Foo'
description: null
description: undefined
members: ['a']
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ declare namespace $Types {
*/
interface Foo {
name: 'Foo'
description: null
description: undefined
members: ['a']
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -204,7 +204,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -512,7 +512,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -262,7 +262,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -475,7 +475,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -688,7 +688,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -901,7 +901,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -1068,7 +1068,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down Expand Up @@ -1281,7 +1281,7 @@ declare namespace $Types {
*/
interface SomeModel {
$name: 'SomeModel'
$description: null
$description: undefined
/**
* Nexus \`t.field\` related configuration based on the \`SomeModel.id\` field in your Prisma schema.
*
Expand Down

0 comments on commit cffc94d

Please sign in to comment.