Skip to content

Commit 2a753b7

Browse files
Merge pull request #3870 from Shopify/2025-01-action
Exclude ActionTargetApi and StandardApi from POS targets JSON
2 parents 40b362e + 9ffcd53 commit 2a753b7

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

packages/ui-extensions/docs/surfaces/point-of-sale/build-docs-targets-json.mjs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ function getNestedApis(apiName) {
451451
}
452452
}
453453

454+
// APIs that are composites of other documented APIs - we list their constituent APIs, not these wrapper types
455+
const COMPOSITE_APIS = new Set(['StandardApi', 'ActionTargetApi']);
456+
454457
function parseApis(apiString) {
455458
const apisSet = new Set();
456459

@@ -480,16 +483,24 @@ function parseApis(apiString) {
480483
}
481484

482485
if (apiName) {
483-
// Add the API itself
484-
apisSet.add(apiName);
486+
if (!COMPOSITE_APIS.has(apiName)) {
487+
apisSet.add(apiName);
488+
}
485489

486-
// Get nested APIs from this API (recursively)
487490
const nestedApis = getNestedApis(apiName);
488491
for (const nestedApi of nestedApis) {
489-
apisSet.add(nestedApi);
490-
// Recursively get nested APIs of nested APIs
491-
const deepNestedApis = getNestedApis(nestedApi);
492-
deepNestedApis.forEach((api) => apisSet.add(api));
492+
if (COMPOSITE_APIS.has(nestedApi)) {
493+
const deepNestedApis = getNestedApis(nestedApi);
494+
deepNestedApis.forEach((api) => {
495+
if (!COMPOSITE_APIS.has(api)) apisSet.add(api);
496+
});
497+
} else {
498+
apisSet.add(nestedApi);
499+
const deepNestedApis = getNestedApis(nestedApi);
500+
deepNestedApis.forEach((api) => {
501+
if (!COMPOSITE_APIS.has(api)) apisSet.add(api);
502+
});
503+
}
493504
}
494505
}
495506
}

0 commit comments

Comments
 (0)