fix(catalog-backend): preserve default allowedLocationTypes

Signed-off-by: Thomas Cardonne <thomas.cardonne@adevinta.com>
This commit is contained in:
Thomas Cardonne
2024-07-25 00:18:15 +02:00
parent 22b42e5b3c
commit 51240ee9f7
2 changed files with 11 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Preserve default `allowedLocationTypes` when `setAllowedLocationTypes()` of `CatalogLocationsExtensionPoint` is not called.
@@ -46,7 +46,7 @@ import { ForwardedError } from '@backstage/errors';
class CatalogLocationsExtensionPointImpl
implements CatalogLocationsExtensionPoint
{
#locationTypes = new Array<string>();
#locationTypes: string[] | undefined;
setAllowedLocationTypes(locationTypes: Array<string>) {
this.#locationTypes = locationTypes;
@@ -293,9 +293,11 @@ export const catalogPlugin = createBackendPlugin({
builder.addPermissionRules(...permissionExtensions.permissionRules);
builder.setFieldFormatValidators(modelExtensions.fieldValidators);
builder.setAllowedLocationTypes(
locationTypeExtensions.allowedLocationTypes,
);
if (locationTypeExtensions.allowedLocationTypes) {
builder.setAllowedLocationTypes(
locationTypeExtensions.allowedLocationTypes,
);
}
const { processingEngine, router } = await builder.build();