diff --git a/.changeset/gorgeous-apples-reply.md b/.changeset/gorgeous-apples-reply.md new file mode 100644 index 0000000000..c781617d22 --- /dev/null +++ b/.changeset/gorgeous-apples-reply.md @@ -0,0 +1,5 @@ +--- +'@backstage/config-loader': minor +--- + +Forward `null` values read from configuration files in configuration data, rather treating them as absence of config. diff --git a/packages/config-loader/src/sources/transform/apply.test.ts b/packages/config-loader/src/sources/transform/apply.test.ts index ea87734036..9f1dfbc672 100644 --- a/packages/config-loader/src/sources/transform/apply.test.ts +++ b/packages/config-loader/src/sources/transform/apply.test.ts @@ -17,7 +17,7 @@ import { applyConfigTransforms } from './apply'; describe('applyConfigTransforms', () => { - it('should apply not transforms to input', async () => { + it('should apply no transforms to input', async () => { const data = applyConfigTransforms( { app: { @@ -35,7 +35,8 @@ describe('applyConfigTransforms', () => { app: { title: 'Test', x: 1, - y: [true], + y: [null, true], + z: null, }, }); }); @@ -77,7 +78,8 @@ describe('applyConfigTransforms', () => { app: { title: ['T', 'e', 's', 't'], x: 2, - y: [true], + y: [null, true], + z: null, }, }); }); diff --git a/packages/config-loader/src/sources/transform/apply.ts b/packages/config-loader/src/sources/transform/apply.ts index d0d8650fe7..48d9c5a1e8 100644 --- a/packages/config-loader/src/sources/transform/apply.ts +++ b/packages/config-loader/src/sources/transform/apply.ts @@ -58,7 +58,7 @@ export async function applyConfigTransforms( if (typeof obj !== 'object') { return obj; } else if (obj === null) { - return undefined; + return null; } else if (Array.isArray(obj)) { const arr = new Array();