Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/user-guide/asset-registry-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<assetType> - <displayName> [<group>]` followed by ` - <description>` 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.

```
Expand Down
9 changes: 6 additions & 3 deletions src/commands/asset-registry/asset-registry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
17 changes: 11 additions & 6 deletions tests/commands/asset-registry/asset-registry-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test cases when description is present and not present.

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 () => {
Expand Down
Loading