How do document this atypical situation with sequelize

192 views
Skip to first unread message

James Pedid

unread,
Mar 23, 2019, 4:14:31 PM3/23/19
to JSDoc Users
Hello,

I'm looking to provide JS docs for a particular implementation of sequelize.

I have a model definition file that looks like this:

export function defineMyModel(sequelize, DataTypes) {
 
const attributes = {...my model attributes};
 
const options = {...my model options};

  // MyModel is a constructor function  
 
const MyModel = sequelize.define('MyModel', attributes, options);

 
MyModel.staticMethod = function staticMethod() {...};

 
MyModel.prototype.instanceMethod = function instanceMethod() { ... };
}


Sequelize has a concept of a Model and an Instance. At an interface level, they are separate entities. At an implementation level, an Instance is an instance of the Model.

I need to document this so that there are two types: MyModel and MyModelInstance. MyModel extends the sequelize Model interface, and MyModelInstance extends the sequelize Instance interface.

When I annotate 
/**
 *  @module MyModule
 */


export function defineMyModel(sequelize, DataTypes) {
 
const attributes = {...my model attributes};
 
const options = {...my model options};

 
/**
   *  @class MyModel
   *  @extends SequelizeModel
   */
  /**
   *  @class MyModelInstance
   *  @extends SequelizeInstance
   */
 
const MyModel = sequelize.define('MyModel', attributes, options);

 
/**
   *  @memberof MyModel
   *  @instance
   */

 
MyModel.staticMethod = function staticMethod() {...};

 
/**
   *  @memberof MyModelInstance
   *  @instance
   */

 
MyModel.prototype.instanceMethod = function instanceMethod() { ... };
}

Nothing is showing up in the updated logs.

Can anyone advise how to achieve the documentation I'm looking for?
Reply all
Reply to author
Forward
0 new messages