Updated the api to include the latest changes, fixed the id of the api-method-index, moved the index out of the
existing menu as to prevent the other options in the menu from being hidden. Added the options of an enum param to the docs.
This commit is contained in:
@ -66,11 +66,24 @@ module.exports = function (branch, done) {
|
||||
});
|
||||
|
||||
apiSpec = {
|
||||
actions: groups.normal,
|
||||
proxies: groups.proxies,
|
||||
actions: groups.normal || [],
|
||||
proxies: groups.proxies || [],
|
||||
namespaces: _.unique(namespaces.sort(), true)
|
||||
};
|
||||
|
||||
var create = _.assign({}, _.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;
|
||||
}
|
||||
|
||||
apiSpec.proxies.push(create);
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
@ -100,6 +113,7 @@ module.exports = function (branch, done) {
|
||||
function formatDocVars(done) {
|
||||
// merge the actions and proxies to make
|
||||
// itteration easir and keep them in order
|
||||
|
||||
docVars = _.omit(apiSpec, 'proxies');
|
||||
docVars.actions = _.sortBy(
|
||||
[].concat(apiSpec.actions).concat(apiSpec.proxies),
|
||||
@ -293,11 +307,6 @@ module.exports = function (branch, done) {
|
||||
throw new Error('unable to pick a method for ' + JSON.stringify(action, null, ' '));
|
||||
}
|
||||
|
||||
if (action.name === 'create') {
|
||||
action.proxy = 'index';
|
||||
action.transformBody = 'params.op_type = \'create\';';
|
||||
}
|
||||
|
||||
actions.push(action);
|
||||
});
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ NOTE: This is currently the default API, but with the upcoming release of Elasti
|
||||
}
|
||||
|
||||
// method index%>
|
||||
[[js-api-method-index]]<%
|
||||
[[js-api-method-index<%= branchSuffix %>]]<%
|
||||
actions = _.sortBy(actions, 'namespace');
|
||||
_.each(actions, function (action) {
|
||||
action.index = 'api-' + action.name.toLowerCase().replace(/[^\w]+/g, '-') + branchSuffix; %>
|
||||
@ -46,12 +46,19 @@ The default method is `<%= action.spec.method || 'GET' %>` and the usual <<api-c
|
||||
_.each(action.allParams, function (param, paramName) { %>
|
||||
`<%= paramWithDefault(paramName, param.default) %>`::
|
||||
`<%= paramType(param.type) %>` -- <%= joinParagraphs(param.description || '', 4) %><%
|
||||
if (param.type === 'enum') {%>
|
||||
Options:::<%
|
||||
_.each(param.options, function (opt) {%>
|
||||
* `"<%= opt %>"`<%
|
||||
});%>
|
||||
<%
|
||||
} // endif enum
|
||||
|
||||
}); // endeach %>
|
||||
}); // endeach param %>
|
||||
|
||||
link:#[back to top]<%
|
||||
|
||||
} // endif
|
||||
} // endif size allParams
|
||||
|
||||
}); // endeach
|
||||
%>
|
||||
|
||||
Reference in New Issue
Block a user