From 8f1cc99d3b6020e42d04d5523a3466a9834f2eb5 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 23 Feb 2022 11:46:33 +0100 Subject: [PATCH] chore: entityName -> entityRef Signed-off-by: blam --- plugins/scaffolder/src/api.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts index 62fc06a6db..594ca74aa4 100644 --- a/plugins/scaffolder/src/api.ts +++ b/plugins/scaffolder/src/api.ts @@ -14,7 +14,11 @@ * limitations under the License. */ -import { EntityName } from '@backstage/catalog-model'; +import { + EntityName, + EntityRef, + parseEntityRef, +} from '@backstage/catalog-model'; import { createApiRef, DiscoveryApi, @@ -70,7 +74,7 @@ export type CustomField = { */ export interface ScaffolderApi { getTemplateParameterSchema( - templateName: EntityName, + templateRef: EntityRef, ): Promise; /** @@ -136,14 +140,15 @@ export class ScaffolderClient implements ScaffolderApi { } async getTemplateParameterSchema( - templateName: EntityName, + templateRef: EntityRef, ): Promise { - const { namespace, kind, name } = templateName; + const { namespace, kind, name } = parseEntityRef(templateRef); const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); const templatePath = [namespace, kind, name] .map(s => encodeURIComponent(s)) .join('/'); + const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`; const response = await this.fetchApi.fetch(url);