refactor(json): Consolidate JSON utilities and type definitions
Modified files: - client/src/components/DynamicJsonForm.tsx - client/src/components/JsonView.tsx - client/src/components/ToolsTab.tsx - client/src/components/__tests__/DynamicJsonForm.test.tsx - client/src/utils/__tests__/jsonPathUtils.test.ts → client/src/utils/__tests__/jsonUtils.test.ts - client/src/utils/__tests__/schemaUtils.test.ts - client/src/utils/jsonPathUtils.ts → client/src/utils/jsonUtils.ts - client/src/utils/schemaUtils.ts Descriptions: - Move JSON type definitions from DynamicJsonForm to centralized jsonUtils - Consolidate utility functions (getDataType, tryParseJson) into jsonUtils - Rename jsonPathUtils to jsonUtils for better semantic clarity - Add comprehensive test coverage for new utility functions - Update imports across all affected components - Improve type references consistency throughout the codebase
This commit is contained in:
@@ -3,33 +3,9 @@ import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import JsonEditor from "./JsonEditor";
|
||||
import { updateValueAtPath, JsonObject } from "@/utils/jsonPathUtils";
|
||||
import { updateValueAtPath } from "@/utils/jsonUtils";
|
||||
import { generateDefaultValue, formatFieldLabel } from "@/utils/schemaUtils";
|
||||
|
||||
export type JsonValue =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| undefined
|
||||
| JsonValue[]
|
||||
| { [key: string]: JsonValue };
|
||||
|
||||
export type JsonSchemaType = {
|
||||
type:
|
||||
| "string"
|
||||
| "number"
|
||||
| "integer"
|
||||
| "boolean"
|
||||
| "array"
|
||||
| "object"
|
||||
| "null";
|
||||
description?: string;
|
||||
required?: boolean;
|
||||
default?: JsonValue;
|
||||
properties?: Record<string, JsonSchemaType>;
|
||||
items?: JsonSchemaType;
|
||||
};
|
||||
import type { JsonValue, JsonSchemaType, JsonObject } from "@/utils/jsonUtils";
|
||||
|
||||
interface DynamicJsonFormProps {
|
||||
schema: JsonSchemaType;
|
||||
|
||||
Reference in New Issue
Block a user