Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Commit

Permalink
Merge pull request #75 from subeeshcbabu/properties
Browse files Browse the repository at this point in the history
Skip the model generation for type array
  • Loading branch information
tlivings committed Mar 17, 2016
2 parents 0b69035 + 6618296 commit 8e1d29d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ var ModuleGenerator = yeoman.generators.Base.extend({
if (!model.id) {
model.id = modelName;
}
//For Array of items/models referenced as part of definitions, no need
//generate a model file.
if (model.type === 'array' && model.items) {
return;
}

self.template('_model.js', path.join(self.appRoot, 'models/' + fileName), model);
});
Expand Down Expand Up @@ -312,6 +317,11 @@ var ModuleGenerator = yeoman.generators.Base.extend({

options = {};
modelSchema = api.definitions[key];
//For Array of items/models referenced as part of definitions, no need
//generate a model file.
if (modelSchema.type === 'array' && modelSchema.items) {
return;
}
ModelCtor = require(path.join(self.appRoot, 'models/' + key.toLowerCase() + '.js'));

Object.keys(modelSchema.properties).forEach(function (prop) {
Expand Down

0 comments on commit 8e1d29d

Please sign in to comment.