json-schema-builder-react 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/components/JsonOutput.d.ts +5 -0
- package/dist-lib/components/JsonSchemaBuilder.d.ts +64 -0
- package/dist-lib/components/PropertyDocument.d.ts +11 -0
- package/dist-lib/components/PropertyEditDialog.d.ts +16 -0
- package/dist-lib/components/SchemaMetadata.d.ts +8 -0
- package/dist-lib/components/ThemeToggle.d.ts +1 -0
- package/dist-lib/components/ui/button.d.ts +11 -0
- package/dist-lib/components/ui/card.d.ts +8 -0
- package/dist-lib/components/ui/checkbox.d.ts +4 -0
- package/dist-lib/components/ui/dialog.d.ts +19 -0
- package/dist-lib/components/ui/input.d.ts +3 -0
- package/dist-lib/components/ui/label.d.ts +5 -0
- package/dist-lib/components/ui/select.d.ts +13 -0
- package/dist-lib/components/ui/textarea.d.ts +3 -0
- package/dist-lib/components/ui/tooltip.d.ts +7 -0
- package/dist-lib/contexts/TypeLabelsContext.d.ts +12 -0
- package/dist-lib/hooks/usePropertyEditor.d.ts +9 -0
- package/dist-lib/hooks/useSchemaBuilder.d.ts +19 -0
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.d.ts +7 -0
- package/dist-lib/index.js +755 -763
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/file-utils.d.ts +8 -0
- package/dist-lib/lib/id-generator.d.ts +8 -0
- package/dist-lib/lib/schema-generator.d.ts +6 -0
- package/dist-lib/lib/schema-parser.d.ts +14 -0
- package/dist-lib/lib/string-utils.d.ts +9 -0
- package/dist-lib/lib/utils.d.ts +2 -0
- package/dist-lib/types/schema.d.ts +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PropertyData, SchemaMetadata } from "@/types/schema";
|
|
2
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
|
+
/**
|
|
4
|
+
* Generate a JSON Schema from property definitions
|
|
5
|
+
*/
|
|
6
|
+
export declare const generateSchema: (properties: PropertyData[], metadata?: SchemaMetadata, includeMetadata?: boolean) => JSONSchema7;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSONSchema7 } from "json-schema";
|
|
2
|
+
import type { PropertyData, SchemaMetadata } from "@/types/schema";
|
|
3
|
+
export interface ParsedSchema {
|
|
4
|
+
properties: PropertyData[];
|
|
5
|
+
metadata?: SchemaMetadata;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parse a JSON Schema into PropertyData array
|
|
9
|
+
*/
|
|
10
|
+
export declare const parseSchema: (schema: JSONSchema7) => ParsedSchema;
|
|
11
|
+
/**
|
|
12
|
+
* Recursively parse properties from a JSON Schema
|
|
13
|
+
*/
|
|
14
|
+
export declare const parseProperties: (props: Record<string, JSONSchema7 | boolean>, requiredList?: string[]) => PropertyData[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a string to snake_case format
|
|
3
|
+
* Removes special characters and replaces spaces with underscores
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* toSnakeCase("User Name") // "user_name"
|
|
7
|
+
* toSnakeCase("First Name!") // "first_name"
|
|
8
|
+
*/
|
|
9
|
+
export declare const toSnakeCase: (str: string) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JSONSchema7TypeName } from "json-schema";
|
|
2
|
+
export type PropertyType = JSONSchema7TypeName | "file";
|
|
3
|
+
/**
|
|
4
|
+
* Internal UI representation of a JSON Schema property
|
|
5
|
+
* This extends JSONSchema7 with additional metadata needed for the builder UI
|
|
6
|
+
*/
|
|
7
|
+
export interface PropertyData {
|
|
8
|
+
id: string;
|
|
9
|
+
key: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
type: PropertyType;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
minLength?: number;
|
|
15
|
+
maxLength?: number;
|
|
16
|
+
pattern?: string;
|
|
17
|
+
enum?: string[];
|
|
18
|
+
minimum?: number;
|
|
19
|
+
maximum?: number;
|
|
20
|
+
minItems?: number;
|
|
21
|
+
maxItems?: number;
|
|
22
|
+
uniqueItems?: boolean;
|
|
23
|
+
items?: PropertyData;
|
|
24
|
+
children?: PropertyData[];
|
|
25
|
+
}
|
|
26
|
+
export interface SchemaMetadata {
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
version: string;
|
|
30
|
+
}
|