Closed Blfrg closed 3 years ago
Getting same issue even with 2.30.1
Looks like the shape of the data has changed from what this method getModelDirective is expecting.
It seems the idFields
property no longer exists and instead there is property on each field called isId
. Could probably update that method to iterate over the fields and do something like the below. Good PR opportunity for someone with more time than me.
for (let i = 0; i < model.fields.length; i+=1) {
const field = model.fields[i];
if (field.isId) {
directiveValue.push({ name: '@@id', values: [field] });
}
if (field.isUnique) {
directiveValue.push({
name: '@@unique',
values: [field],
});
}
}
{
name: 'User',
isEmbedded: false,
dbName: null,
fields: [
{
name: 'id',
kind: 'scalar',
isList: false,
isRequired: true,
isUnique: false,
isId: true,
isReadOnly: false,
type: 'Int',
hasDefaultValue: true,
default: [Object],
isGenerated: false,
isUpdatedAt: false
},
{
name: 'email',
kind: 'scalar',
isList: false,
isRequired: true,
isUnique: true,
isId: false,
isReadOnly: false,
type: 'String',
hasDefaultValue: false,
isGenerated: false,
isUpdatedAt: false
},
{
name: 'name',
kind: 'scalar',
isList: false,
isRequired: false,
isUnique: false,
isId: false,
isReadOnly: false,
type: 'String',
hasDefaultValue: false,
isGenerated: false,
isUpdatedAt: false
},
{
name: 'profile',
kind: 'object',
isList: false,
isRequired: false,
isUnique: false,
isId: false,
isReadOnly: false,
type: 'Profile',
hasDefaultValue: false,
relationName: 'ProfileToUser',
relationFromFields: [],
relationToFields: [],
relationOnDelete: 'SetNull',
isGenerated: false,
isUpdatedAt: false
}
],
isGenerated: false,
primaryKey: null,
uniqueFields: [],
uniqueIndexes: []
}
Hello
SDK had a breaking change so this will require a new release. Stay tuned, I plan to work on it this weekend.
Sorry for the delay here. This is fixed in https://github.com/pantharshit00/prisma-docs-generator/releases/tag/v0.5.0 https://www.npmjs.com/package/prisma-docs-generator/v/0.5.0
Starting with prisma version 2.29.0 to current (2.30.0); The following error now appears when generating docs:
Reverting back to prisma version 2.28.0 the error no longer appears.