Support for deprecated paths (#828)

* Updated code generation

* API generation

* Updated test
This commit is contained in:
Tomas Della Vedova
2019-04-26 09:25:34 +02:00
committed by delvedor
parent dbfeb5d1a9
commit 12e88d6f87
6 changed files with 29 additions and 13 deletions

View File

@ -94,12 +94,6 @@ function buildDelete (opts) {
return handleError(err, callback)
}
// check required url components
if (params['id'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)

View File

@ -96,12 +96,6 @@ function buildIndex (opts) {
return handleError(err, callback)
}
// check required url components
if (params['id'] != null && (params['index'] == null)) {
const err = new ConfigurationError('Missing required parameter of the url: index')
return handleError(err, callback)
}
// validate headers object
if (options.headers != null && typeof options.headers !== 'object') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)

View File

@ -111,6 +111,7 @@ function buildIndicesPutMapping (opts) {
} else if ((index) != null && (type) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
<<<<<<< HEAD
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
@ -118,6 +119,15 @@ function buildIndicesPutMapping (opts) {
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
=======
path = '/' + '_mappings' + '/' + encodeURIComponent(type)
} else if ((type) != null) {
path = '/' + '_mapping' + '/' + encodeURIComponent(type)
} else if ((index) != null) {
path = '/' + encodeURIComponent(index) + '/' + '_mapping'
} else {
path = '/' + encodeURIComponent(index) + '/' + '_mappings'
>>>>>>> 349b832... Support for deprecated paths (#828)
}
// build request object

View File

@ -101,9 +101,14 @@ function buildNodesHotThreads (opts) {
} else if ((node_id || nodeId) != null) {
path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
} else if ((node_id || nodeId) != null) {
<<<<<<< HEAD
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
} else if ((node_id || nodeId) != null) {
=======
>>>>>>> 349b832... Support for deprecated paths (#828)
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
} else if ((node_id || nodeId) != null) {
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
} else {
path = '/' + '_cluster' + '/' + 'nodes' + '/' + 'hotthreads'
}