diff --git a/docs/user-guide/asset-registry-commands.md b/docs/user-guide/asset-registry-commands.md index 8f3e56e..8c192d3 100644 --- a/docs/user-guide/asset-registry-commands.md +++ b/docs/user-guide/asset-registry-commands.md @@ -14,10 +14,12 @@ content-cli asset-registry list Example output: ``` -BOARD_V2 - View [DASHBOARDS] (basePath: /blueprint/api) -SEMANTIC_MODEL - Knowledge Model [DATA_AND_PROCESS_MODELING] (basePath: /semantic-layer/api) +BOARD_V2 - View [DASHBOARDS] +SEMANTIC_MODEL - Knowledge Model [DATA_AND_PROCESS_MODELING] - Defines KPIs, records, filters, and data bindings for analytics ``` +Each line is ` - []` followed by ` - ` when the asset type provides one. + It is also possible to use the `--json` option for writing the full response to a file that gets created in the working directory. ``` diff --git a/src/commands/asset-registry/asset-registry.service.ts b/src/commands/asset-registry/asset-registry.service.ts index becc5ae..799afd8 100644 --- a/src/commands/asset-registry/asset-registry.service.ts +++ b/src/commands/asset-registry/asset-registry.service.ts @@ -131,9 +131,12 @@ export class AssetRegistryService { } private logDescriptorSummary(descriptor: AssetRegistryDescriptor): void { - logger.info( - `${descriptor.assetType} - ${descriptor.displayName} [${descriptor.group}]` - ); + const base = `${descriptor.assetType} - ${descriptor.displayName} [${descriptor.group}]`; + if (descriptor.description) { + logger.info(`${base} - ${descriptor.description}`); + } else { + logger.info(base); + } } private logDescriptorDetail(descriptor: AssetRegistryDescriptor): void { diff --git a/tests/commands/asset-registry/asset-registry-list.spec.ts b/tests/commands/asset-registry/asset-registry-list.spec.ts index a3ab652..2c8b24c 100644 --- a/tests/commands/asset-registry/asset-registry-list.spec.ts +++ b/tests/commands/asset-registry/asset-registry-list.spec.ts @@ -42,17 +42,22 @@ describe("Asset registry list", () => { }, }; - it("Should list all asset types", async () => { + it("Should list all asset types with description when present", async () => { mockAxiosGet("https://myTeam.celonis.cloud/pacman/api/core/asset-registry/types", metadata); await new AssetRegistryService(testContext).listTypes(false); expect(loggingTestTransport.logMessages.length).toBe(2); - expect(loggingTestTransport.logMessages[0].message).toContain("BOARD_V2"); - expect(loggingTestTransport.logMessages[0].message).toContain("View"); - expect(loggingTestTransport.logMessages[0].message).toContain("DASHBOARDS"); - expect(loggingTestTransport.logMessages[1].message).toContain("SEMANTIC_MODEL"); - expect(loggingTestTransport.logMessages[1].message).toContain("Knowledge Model"); + + expect(loggingTestTransport.logMessages[0].message).toContain( + "BOARD_V2 - View [DASHBOARDS]" + ); + expect(loggingTestTransport.logMessages[0].message).not.toContain(" - null"); + expect(loggingTestTransport.logMessages[0].message).not.toMatch(/\] - /); + + expect(loggingTestTransport.logMessages[1].message).toContain( + "SEMANTIC_MODEL - Knowledge Model [DATA_AND_PROCESS_MODELING] - Defines KPIs, records, filters, and data bindings for analytics" + ); }); it("Should list all asset types as JSON", async () => {