Skip to content

Commit be63221

Browse files
committed
Fix listAll path for out-of-basePath routes
The listAll emitter was missing the same LCP-based path fix applied to regular methods, causing broken paths like \`\${this.basePath}l-platforms\` instead of the full URL.
1 parent a91ab6a commit be63221

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

scripts/generate-services.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,9 +911,16 @@ function emitListAllMethod(
911911
const pageSizeParam = method.pageSizeParam;
912912

913913
// Build path expression
914-
const relativePath = op.path.slice(basePath.length);
914+
const startsWithBase = op.path.startsWith(basePath);
915+
const relativePath = startsWithBase ? op.path.slice(basePath.length) : null;
915916
let pathExpr: string;
916-
if (!relativePath) {
917+
if (relativePath === null) {
918+
const fullTemplate = op.path.replace(
919+
/\{([^}]+)\}/g,
920+
(_, param) => `\${encodeURIComponent(${param})}`,
921+
);
922+
pathExpr = "`" + fullTemplate + "`";
923+
} else if (!relativePath) {
917924
pathExpr = "this.basePath";
918925
} else {
919926
const pathTemplate = relativePath.replace(

src/generated/services/activation-targets.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class ActivationTargetsServiceBase extends BaseResource {
6060

6161
/** Async generator yielding all items from listExternalPlatforms */
6262
async *listAllExternalPlatforms(params?: PaginationParams, options?: RequestOptions): AsyncGenerator<ActivationExternalPlatformRepresentation, void, undefined> {
63-
yield* this.paginate<ActivationExternalPlatformRepresentation>(`${this.basePath}l-platforms`, { ...params, pageSizeParam: "limit" }, options);
63+
yield* this.paginate<ActivationExternalPlatformRepresentation>(`/ssot/activation-external-platforms`, { ...params, pageSizeParam: "limit" }, options);
6464
}
6565

6666
/** Async generator yielding all items from list */

src/generated/services/data-model-objects.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class DataModelObjectsServiceBase extends BaseResource {
168168
/** Async generator yielding all items from listMappings */
169169
async *listAllMappings(params: PaginationParams & DataModelObjectsListMappingsParams, options?: RequestOptions): AsyncGenerator<CdpObjectSourceTargetMapRepresentation, void, undefined> {
170170
const { batchSize, offset, orderBy, ...query } = params ?? {};
171-
yield* this.paginate<CdpObjectSourceTargetMapRepresentation>(`${this.basePath}mappings`, { batchSize, offset, orderBy, pageSizeParam: "batchSize", query }, options);
171+
yield* this.paginate<CdpObjectSourceTargetMapRepresentation>(`/ssot/data-model-object-mappings`, { batchSize, offset, orderBy, pageSizeParam: "batchSize", query }, options);
172172
}
173173

174174
/** Async generator yielding all items from list */

0 commit comments

Comments
 (0)