From 5aa5283152a799ed37c15e5bdbb71cec9ce17110 Mon Sep 17 00:00:00 2001 From: Eric Roberson Date: Thu, 13 Mar 2025 18:30:24 -0700 Subject: [PATCH 1/3] docs: fix example location annotations in incrementalentityprovider Signed-off-by: Eric Roberson --- docs/features/software-catalog/external-integrations.md | 9 ++++++--- .../README.md | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/features/software-catalog/external-integrations.md b/docs/features/software-catalog/external-integrations.md index 343128bfbf..915726eb6c 100644 --- a/docs/features/software-catalog/external-integrations.md +++ b/docs/features/software-catalog/external-integrations.md @@ -1161,9 +1161,11 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider { private readonly token: string; + private readonly mySource: string; - constructor(token: string) { + constructor(token: string, mySource: string) { this.token = token; + this.mySource = mySource; } getProviderName() { @@ -1181,6 +1183,7 @@ export class MyIncrementalEntityProvider cursor: Cursor = { page: 1 }, ): Promise> { const { apiClient } = context; + const location = `${this.getProviderName()}:${mySource}`; // call your API with the current cursor const data = await apiClient.getServices(cursor); @@ -1200,8 +1203,8 @@ export class MyIncrementalEntityProvider name: item.name, annotations: { // You need to define these, otherwise they'll fail validation - [ANNOTATION_LOCATION]: this.getProviderName(), - [ANNOTATION_ORIGIN_LOCATION]: this.getProviderName(), + [ANNOTATION_LOCATION]: location, + [ANNOTATION_ORIGIN_LOCATION]: location, }, }, spec: { diff --git a/plugins/catalog-backend-module-incremental-ingestion/README.md b/plugins/catalog-backend-module-incremental-ingestion/README.md index 2535fbe8e3..ee47d759b9 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/README.md +++ b/plugins/catalog-backend-module-incremental-ingestion/README.md @@ -211,9 +211,11 @@ The last step is to implement the actual `next` method that will accept the curs export class MyIncrementalEntityProvider implements IncrementalEntityProvider { token: string; + mySource: string; - constructor(token: string) { + constructor(token: string, mySource: string) { this.token = token; + this.mySource = mySource; } getProviderName() { @@ -230,6 +232,7 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider> { const { apiClient } = context; + const location = `${this.getProviderName()}:${mySource}`; // call your API with the current cursor const data = await apiClient.getServices(cursor); @@ -249,8 +252,8 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider Date: Thu, 13 Mar 2025 18:53:08 -0700 Subject: [PATCH 2/3] chore: add changeset Signed-off-by: Eric Roberson --- .changeset/wide-planets-camp.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wide-planets-camp.md diff --git a/.changeset/wide-planets-camp.md b/.changeset/wide-planets-camp.md new file mode 100644 index 0000000000..c36ed69dff --- /dev/null +++ b/.changeset/wide-planets-camp.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-incremental-ingestion': patch +--- + +fixed misleading example location annotations in docs From a580e574ecc779ee799f18a3b0949da3b5d451b4 Mon Sep 17 00:00:00 2001 From: Eric Roberson Date: Tue, 18 Mar 2025 08:05:15 -0700 Subject: [PATCH 3/3] docs: add imports to example Signed-off-by: Eric Roberson --- docs/features/software-catalog/external-integrations.md | 8 +++++++- .../README.md | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/features/software-catalog/external-integrations.md b/docs/features/software-catalog/external-integrations.md index 915726eb6c..64468f7f41 100644 --- a/docs/features/software-catalog/external-integrations.md +++ b/docs/features/software-catalog/external-integrations.md @@ -1157,6 +1157,12 @@ export class MyIncrementalEntityProvider The last step is to implement the actual `next` method that will accept the cursor, call the API, process the result and return the result. ```ts +import { + ANNOTATION_LOCATION, + ANNOTATION_ORIGIN_LOCATION, +} from '@backstage/catalog-model'; +import { IncrementalEntityProvider } from '@backstage/plugin-catalog-backend-module-incremental-ingestion'; + export class MyIncrementalEntityProvider implements IncrementalEntityProvider { @@ -1183,7 +1189,7 @@ export class MyIncrementalEntityProvider cursor: Cursor = { page: 1 }, ): Promise> { const { apiClient } = context; - const location = `${this.getProviderName()}:${mySource}`; + const location = `${this.getProviderName()}:${this.mySource}`; // call your API with the current cursor const data = await apiClient.getServices(cursor); diff --git a/plugins/catalog-backend-module-incremental-ingestion/README.md b/plugins/catalog-backend-module-incremental-ingestion/README.md index ee47d759b9..7673ca08ab 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/README.md +++ b/plugins/catalog-backend-module-incremental-ingestion/README.md @@ -208,6 +208,12 @@ export class MyIncrementalEntityProvider The last step is to implement the actual `next` method that will accept the cursor, call the API, process the result and return the result. ```ts +import { + ANNOTATION_LOCATION, + ANNOTATION_ORIGIN_LOCATION, +} from '@backstage/catalog-model'; +import { IncrementalEntityProvider } from '@backstage/plugin-catalog-backend-module-incremental-ingestion'; + export class MyIncrementalEntityProvider implements IncrementalEntityProvider { token: string; @@ -232,7 +238,7 @@ export class MyIncrementalEntityProvider implements IncrementalEntityProvider> { const { apiClient } = context; - const location = `${this.getProviderName()}:${mySource}`; + const location = `${this.getProviderName()}:${this.mySource}`; // call your API with the current cursor const data = await apiClient.getServices(cursor);