config-loader: forward null values
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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.
|
||||
@@ -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,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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<JsonValue>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user