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