From 839b839111281789eab8a99273a2c7c8674a3894 Mon Sep 17 00:00:00 2001 From: Sambhav Gupta Date: Mon, 15 Jan 2024 12:34:26 +0530 Subject: [PATCH] initial commit to add extensions --- library/src/components/Extensions.tsx | 21 +++++++++++++++------ library/src/config/config.ts | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/library/src/components/Extensions.tsx b/library/src/components/Extensions.tsx index e7ce06630..03005770d 100644 --- a/library/src/components/Extensions.tsx +++ b/library/src/components/Extensions.tsx @@ -1,19 +1,28 @@ import React from 'react'; +import { Schema } from './Schema' +import { SchemaHelpers } from '../helpers'; +import type { AsyncAPIDocumentInterface, BaseModel } from "@asyncapi/parser" +import type { ConfigInterface } from "../config" -import { Schema } from './Schema'; -import { SchemaHelpers } from '../helpers'; +export interface ExtensionComponentProps { + key: string; + value: V; + document: AsyncAPIDocumentInterface + config: ConfigInterface + parent: BaseModel +} interface Props { name?: string; - item: any; + extensions: ExtensionsInterface; } export const Extensions: React.FunctionComponent = ({ - name = 'Extensions', - item, + name = 'Extensions Specific Information', + extensions, }) => { - const extensions = SchemaHelpers.getCustomExtensions(item); + const extensions = SchemaHelpers.getCustomExtensions(extensions); if (!extensions || !Object.keys(extensions).length) { return null; } diff --git a/library/src/config/config.ts b/library/src/config/config.ts index 6a18b040f..d86f20e91 100644 --- a/library/src/config/config.ts +++ b/library/src/config/config.ts @@ -10,6 +10,7 @@ export interface ConfigInterface { receiveLabel?: string; requestLabel?: string; replyLabel?: string; + extensions: Record> } export interface ShowConfig {