Git Product home page Git Product logo

Comments (4)

pantharshit00 avatar pantharshit00 commented on June 9, 2024 9

Hello

SDK had a breaking change so this will require a new release. Stay tuned, I plan to work on it this weekend.

from prisma-docs-generator.

pantharshit00 avatar pantharshit00 commented on June 9, 2024 2

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

from prisma-docs-generator.

enixlabs avatar enixlabs commented on June 9, 2024

Getting same issue even with 2.30.1

from prisma-docs-generator.

connorjones13 avatar connorjones13 commented on June 9, 2024

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],
      });
    }
}

example model object

{
  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: []
}

from prisma-docs-generator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.