[api/generate] prevent overriding the create method
This commit is contained in:
@ -92,19 +92,25 @@ module.exports = function (branch, done) {
|
||||
clientActionModifier: overrides.clientActionModifier
|
||||
};
|
||||
|
||||
var create = _.assign({}, _.find(apiSpec.actions, { name: 'index' }), {
|
||||
name: 'create',
|
||||
location: 'create',
|
||||
proxy: 'index',
|
||||
transformBody: 'params.op_type = \'create\';'
|
||||
});
|
||||
if (!_.find(apiSpec.actions, { name: 'create' })) {
|
||||
var create = _.assign(
|
||||
{},
|
||||
_.cloneDeep(_.find(apiSpec.actions, { name: 'index' })),
|
||||
{
|
||||
name: 'create',
|
||||
location: 'create',
|
||||
proxy: 'index',
|
||||
transformBody: 'params.op_type = \'create\';'
|
||||
}
|
||||
);
|
||||
|
||||
if (create.allParams && create.allParams.opType) {
|
||||
delete create.allParams.opType;
|
||||
if (create.allParams && create.allParams.opType) {
|
||||
delete create.allParams.opType;
|
||||
}
|
||||
|
||||
apiSpec.proxies.push(create);
|
||||
}
|
||||
|
||||
apiSpec.proxies.push(create);
|
||||
|
||||
[].concat(apiSpec.actions, apiSpec.proxies)
|
||||
.forEach(function (action) {
|
||||
var examplePath = examples[action.name] || action.name + '.asciidoc';
|
||||
|
||||
Reference in New Issue
Block a user