Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 3717f33

Browse files
author
Chris Wiechmann
committed
Default the parent custom property
Fixes issue #133
1 parent eb46a00 commit 3717f33

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/src/customProperties.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ async function mergeCustomProperties(params, options) {
3737
logger.info(`Custom properties are ignore for this template.`);
3838
return options.setOutput('noUpdate', desiredIndexTemplate);
3939
}
40+
if (!customPropertiesSettings.parent) {
41+
customPropertiesSettings.parent = ""; // Use no parent as default
42+
}
43+
4044
var updateRequired = false;
4145
for (var prop in customProperties) {
4246
if (Object.prototype.hasOwnProperty.call(customProperties, prop)) {

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/test/test-customProperties-MappingMerge.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ describe('Merge custom properties tests', () => {
7272
expect(value.mappings.properties['customProperties.customProperty3'].type).to.equal('keyword');
7373
});
7474

75-
it('should merge into indexMappingTemplate as custom properties are missing', async () => {
75+
it('should merge into indexMappingTemplate as custom properties are missing and parent is not set', async () => {
7676
const { value, output } = await flowNode.mergeCustomProperties({
7777
customProperties: JSON.parse(fs.readFileSync('./test/testInput/customPropertiesConfig.json'), null),
7878
desiredIndexTemplate: JSON.parse(fs.readFileSync('./test/testInput/desiredIndexTemplate.json'), null),
7979
actualIndexTemplate: JSON.parse(fs.readFileSync('./test/testInput/actualIndexTemplate.json'), null),
80-
customPropertiesSettings: { merge: true, parent: "" }
80+
customPropertiesSettings: { merge: true }
8181
});
8282
expect(output).to.equal('next');
8383
expect(value.mappings.properties['customProperties.customProperty1']).to.be.an('Object');

0 commit comments

Comments
 (0)