+
0">
diff --git a/springwolf-ui/src/app/components/new/schemas/schemas.component.html b/springwolf-ui/src/app/components/new/schemas/schemas.component.html
index 0541ab894..385ac53ea 100644
--- a/springwolf-ui/src/app/components/new/schemas/schemas.component.html
+++ b/springwolf-ui/src/app/components/new/schemas/schemas.component.html
@@ -12,7 +12,7 @@
Schemas
Name
- {{ schema.name }}
+ {{ schema.name }}
Type
@@ -24,9 +24,30 @@
Schemas
Description
+
+
+
+
Example
+
-
+
Properties
+
@if (!$last) {
diff --git a/springwolf-ui/src/app/components/schemas/range/schema-range.component.spec.ts b/springwolf-ui/src/app/components/schemas/range/schema-range.component.spec.ts
index 7ff60443c..d55aa945f 100644
--- a/springwolf-ui/src/app/components/schemas/range/schema-range.component.spec.ts
+++ b/springwolf-ui/src/app/components/schemas/range/schema-range.component.spec.ts
@@ -17,6 +17,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
maximum: 10,
exclusiveMinimum: true,
@@ -31,6 +32,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
maximum: 10,
exclusiveMinimum: true,
@@ -45,6 +47,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
maximum: 10,
exclusiveMinimum: false,
@@ -59,6 +62,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
maximum: 10,
exclusiveMinimum: true,
@@ -73,6 +77,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
maximum: 10,
});
@@ -85,6 +90,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
exclusiveMinimum: true,
});
@@ -97,6 +103,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
maximum: 10,
exclusiveMaximum: true,
});
@@ -109,6 +116,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
minimum: 0.1,
});
@@ -120,6 +128,7 @@ describe("SchemaRangeComponent", function () {
title: "test",
name: "test",
anchorIdentifier: "test",
+ usedBy: [],
maximum: 10,
});
diff --git a/springwolf-ui/src/app/models/channel.model.ts b/springwolf-ui/src/app/models/channel.model.ts
index de34c9a28..82041f2b3 100644
--- a/springwolf-ui/src/app/models/channel.model.ts
+++ b/springwolf-ui/src/app/models/channel.model.ts
@@ -6,6 +6,7 @@ export const CHANNEL_ANCHOR_PREFIX = "channel-";
export interface ChannelOperation {
name: string;
anchorIdentifier: string;
+ anchorUrl: string;
description?: string;
operation: Operation;
bindings: Bindings;
diff --git a/springwolf-ui/src/app/models/schema.model.ts b/springwolf-ui/src/app/models/schema.model.ts
index e75041073..34cc5793c 100644
--- a/springwolf-ui/src/app/models/schema.model.ts
+++ b/springwolf-ui/src/app/models/schema.model.ts
@@ -11,6 +11,7 @@ export interface Schema {
*/
title: string;
anchorIdentifier: string;
+ usedBy: { name: string; anchorUrl: string; type: "channel" | "schema" }[];
description?: string;
deprecated?: boolean;
diff --git a/springwolf-ui/src/app/service/asyncapi/asyncapi-mapper.service.ts b/springwolf-ui/src/app/service/asyncapi/asyncapi-mapper.service.ts
index a151cfe32..490c26677 100644
--- a/springwolf-ui/src/app/service/asyncapi/asyncapi-mapper.service.ts
+++ b/springwolf-ui/src/app/service/asyncapi/asyncapi-mapper.service.ts
@@ -50,7 +50,7 @@ export class AsyncApiMapperService {
item.servers,
item.defaultContentType
);
- return {
+ const asyncApi = {
info: this.mapInfo(item),
servers: this.mapServers(item.servers),
channels: channels,
@@ -59,6 +59,8 @@ export class AsyncApiMapperService {
schemas: this.mapSchemas(item.components.schemas),
},
};
+ this.postProcess(asyncApi);
+ return asyncApi;
} catch (e: any) {
this.notificationService.showError(
"Error parsing AsyncAPI: " + e?.message
@@ -223,16 +225,18 @@ export class AsyncApiMapperService {
operation.reply
);
+ const anchorIdentifier =
+ CHANNEL_ANCHOR_PREFIX +
+ [
+ mappedOperation.protocol,
+ channelName,
+ mappedOperation.operationType,
+ mappedOperation.message.title,
+ ].join("-");
return {
name: channelName,
- anchorIdentifier:
- CHANNEL_ANCHOR_PREFIX +
- [
- mappedOperation.protocol,
- channelName,
- mappedOperation.operationType,
- mappedOperation.message.title,
- ].join("-"),
+ anchorIdentifier: anchorIdentifier,
+ anchorUrl: AsyncApiMapperService.BASE_URL + anchorIdentifier,
description: channel.description,
operation: mappedOperation,
bindings: channel.bindings || {},
@@ -444,6 +448,7 @@ export class AsyncApiMapperService {
return {
name: schemaName,
title: schemaName.split(".")?.pop() || "undefined-title",
+ usedBy: [],
anchorIdentifier: schemaName,
description: schema.description,
deprecated: schema.deprecated,
@@ -514,6 +519,7 @@ export class AsyncApiMapperService {
return {
name: schemaName,
title: schemaName.split(".").pop()!!,
+ usedBy: [],
anchorIdentifier: schemaName,
// type == ref
@@ -538,6 +544,43 @@ export class AsyncApiMapperService {
}
}
+ private postProcess(asyncApi: AsyncApi) {
+ asyncApi.components.schemas.forEach((schema) => {
+ asyncApi.channels.forEach((channel) => {
+ channel.operations.forEach((channelOperation) => {
+ if (
+ channelOperation.operation.message.payload.title === schema.name
+ ) {
+ schema.usedBy.push({
+ name: channelOperation.name,
+ anchorUrl: channelOperation.anchorUrl!!,
+ type: "channel",
+ });
+ }
+ });
+ });
+
+ asyncApi.components.schemas.forEach((otherSchema) => {
+ Object.values(otherSchema?.properties || {}).forEach((property) => {
+ if (property.refTitle === schema.name) {
+ schema.usedBy.push({
+ name: otherSchema.title,
+ anchorUrl: otherSchema.anchorUrl!!,
+ type: "schema",
+ });
+ }
+ });
+ if (otherSchema.items?.refTitle === schema.name) {
+ schema.usedBy.push({
+ name: otherSchema.title,
+ anchorUrl: otherSchema.anchorUrl!!,
+ type: "schema",
+ });
+ }
+ });
+ });
+ }
+
private parsingErrorBoundary
(path: string, f: () => T): T | undefined {
return catchException(f, (e) => {
this.notificationService.showError(
diff --git a/springwolf-ui/src/app/service/mock/init-values.ts b/springwolf-ui/src/app/service/mock/init-values.ts
index e5bd12e12..08e498ae3 100644
--- a/springwolf-ui/src/app/service/mock/init-values.ts
+++ b/springwolf-ui/src/app/service/mock/init-values.ts
@@ -41,4 +41,5 @@ export const initSchema: Schema = {
title: "",
name: "",
anchorIdentifier: "",
+ usedBy: [],
};