From 6618296b3f000cdb932d01e608c37805f46206c9 Mon Sep 17 00:00:00 2001 From: suchothendav Date: Mon, 22 Feb 2016 21:48:13 -0800 Subject: [PATCH] Skip the model generation for arrays #73 --- app/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/index.js b/app/index.js index 85cef3a..77da033 100644 --- a/app/index.js +++ b/app/index.js @@ -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); }); @@ -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) {