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);