frontend-app-api: cleanup route binding config reading

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-10-14 12:54:45 +02:00
parent c4c13a6cb1
commit 332a3702b3
@@ -21,6 +21,7 @@ import {
} from '@backstage/frontend-plugin-api';
import { RouteRefsById } from './collectRouteIds';
import { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
/**
* Extracts a union of the keys in a map whose value extends the given type
@@ -109,11 +110,7 @@ export function resolveRouteBindings(
return result;
}
const bindings = bindingsConfig.get();
if (bindings === null || typeof bindings !== 'object') {
throw new Error('Invalid config at app.routes.bindings, must be an object');
}
const bindings = bindingsConfig.get<JsonObject>();
for (const [externalRefId, targetRefId] of Object.entries(bindings)) {
if (typeof targetRefId !== 'string' || targetRefId === '') {
throw new Error(