{pattern}
diff --git a/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/__tests__/SchemaObjectContent.test.tsx b/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/__tests__/SchemaObjectContent.test.tsx
index d2373021..f3f38e18 100644
--- a/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/__tests__/SchemaObjectContent.test.tsx
+++ b/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/__tests__/SchemaObjectContent.test.tsx
@@ -21,6 +21,37 @@ const fake_properties = {
},
};
+const stream_types_schema = {
+ properties: {
+ test_property: {
+ description: 'property description',
+ oneOf: 'this is oneOf key',
+ },
+ },
+ definitions: {
+ stream_types: {
+ description: 'This stream_types description',
+ type: 'string',
+ enum: [
+ 'balance',
+ 'candles',
+ 'cashier_payments',
+ 'p2p_advert',
+ 'p2p_advertiser',
+ 'p2p_order',
+ 'proposal',
+ 'proposal_open_contract',
+ 'ticks',
+ 'transaction',
+ 'trading_platform_asset_listing',
+ 'website_status',
+ 'p2p_settings',
+ 'crypto_estimations',
+ ],
+ },
+ },
+};
+
describe('SchemaObjectContent', () => {
it('should be able to open a nested object item', async () => {
render(
);
@@ -96,4 +127,24 @@ describe('SchemaObjectContent', () => {
const schema = await screen.findByTitle('JSON');
expect(schema).toBeVisible();
});
+
+ it('should open StreamTypesObject upon clicking stream_types button', async () => {
+ render(
+
,
+ );
+
+ const button = await screen.findByRole('button', { name: /stream_types/i });
+ expect(button).toBeVisible();
+
+ await userEvent.click(button);
+
+ const streamTypesObject = await screen.getByTestId('dt_stream_types_object');
+ expect(streamTypesObject).toBeVisible();
+ });
});
diff --git a/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/index.tsx b/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/index.tsx
index 499e9282..5a3c77dc 100644
--- a/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/index.tsx
+++ b/src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/index.tsx
@@ -10,9 +10,16 @@ const ReactJson = React.lazy(() => import('react-json-view'));
type TSchemaObjectContent = {
key_value: string;
properties: any;
+ jsonSchema?: any;
+ is_stream_types?: boolean;
};
-export default function SchemaObjectContent({ key_value, properties }: TSchemaObjectContent) {
+export default function SchemaObjectContent({
+ key_value,
+ properties,
+ jsonSchema,
+ is_stream_types = false,
+}: TSchemaObjectContent) {
const [is_open_object, setIsOpenObject] = useState
(false);
const [is_code_open, setIsCodeOpen] = useState(false);
const {
@@ -52,6 +59,7 @@ export default function SchemaObjectContent({ key_value, properties }: TSchemaOb
title={title}
is_open_object={is_open_object}
setIsOpenObject={setIsOpenObject}
+ is_stream_types={is_stream_types}
/>
{/* Description */}
@@ -68,6 +76,7 @@ export default function SchemaObjectContent({ key_value, properties }: TSchemaOb
is_open={is_open_object}
properties={value.properties || value?.items?.properties}
value={value}
+ jsonSchema={jsonSchema}
/>
)}
diff --git a/src/features/Apiexplorer/Schema/RecursiveContent/StreamTypesObject/StreamTypesBody.tsx b/src/features/Apiexplorer/Schema/RecursiveContent/StreamTypesObject/StreamTypesBody.tsx
new file mode 100644
index 00000000..32b0c98d
--- /dev/null
+++ b/src/features/Apiexplorer/Schema/RecursiveContent/StreamTypesObject/StreamTypesBody.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import { TEnumStreamType } from '@site/src/types';
+import styles from '../../Schema.module.scss';
+
+type TStreamTypesBody = {
+ type: string;
+ _enum: TEnumStreamType;
+};
+
+const StreamTypesBody = ({ type, _enum }: TStreamTypesBody) => {
+ return (
+