diff --git a/package.json b/package.json
index 835afed0..d22dd0b0 100644
--- a/package.json
+++ b/package.json
@@ -109,6 +109,7 @@
"flatten-anything": "^4.0.1",
"fuse.js": "^6.6.2",
"hash-wasm": "^4.11.0",
+ "generate-schema": "^2.6.0",
"highlight.js": "^11.7.0",
"iarna-toml-esm": "^3.0.5",
"ibantools": "^4.3.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ce0c3d3e..c7a680a7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -203,6 +203,9 @@ dependencies:
fuse.js:
specifier: ^6.6.2
version: 6.6.2
+ generate-schema:
+ specifier: ^2.6.0
+ version: 2.6.0
hash-wasm:
specifier: ^4.11.0
version: 4.11.0
@@ -4951,7 +4954,7 @@ packages:
/@vueuse/shared@10.0.0(vue@3.3.4):
resolution: {integrity: sha512-Zh3LgJqvUBWVY3SiMvXanTcfAneGbt63QPczBRDNgQ6jd/ehodO9a1lCFzaA6SWJJoI+ugVTjHFYJdoR656DVQ==}
dependencies:
- vue-demi: 0.14.10(vue@3.3.4)
+ vue-demi: 0.14.5(vue@3.3.4)
transitivePeerDependencies:
- '@vue/composition-api'
- vue
@@ -7467,6 +7470,14 @@ packages:
engines: {node: '>=10'}
dev: false
+ /generate-schema@2.6.0:
+ resolution: {integrity: sha512-EUBKfJNzT8f91xUk5X5gKtnbdejZeE065UAJ3BCzE8VEbvwKI9Pm5jaWmqVeK1MYc1g5weAVFDTSJzN7ymtTqA==}
+ hasBin: true
+ dependencies:
+ commander: 2.20.3
+ type-of-is: 3.5.1
+ dev: false
+
/gensync@1.0.0-beta.2:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
@@ -11447,6 +11458,11 @@ packages:
engines: {node: '>=8'}
dev: true
+ /type-of-is@3.5.1:
+ resolution: {integrity: sha512-SOnx8xygcAh8lvDU2exnK2bomASfNjzB3Qz71s2tw9QnX8fkAo7aC+D0H7FV0HjRKj94CKV2Hi71kVkkO6nOxg==}
+ engines: {node: '>=0.10.5'}
+ dev: false
+
/typed-array-buffer@1.0.0:
resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==}
engines: {node: '>= 0.4'}
diff --git a/src/tools/index.ts b/src/tools/index.ts
index a79e2cc6..9fc831ba 100644
--- a/src/tools/index.ts
+++ b/src/tools/index.ts
@@ -56,6 +56,7 @@ import { tool as icalParser } from './ical-parser';
import { tool as icalGenerator } from './ical-generator';
import { tool as imageToCss } from './image-to-css';
import { tool as jsonToGo } from './json-to-go';
+import { tool as jsonToSchema } from './json-to-schema';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -259,6 +260,7 @@ export const toolsByCategory: ToolCategory[] = [
jqTester,
jqMemo,
jsonpathMemo,
+ jsonToSchema,
],
},
{
diff --git a/src/tools/json-to-schema/generate-schema.d.ts b/src/tools/json-to-schema/generate-schema.d.ts
new file mode 100644
index 00000000..5b081983
--- /dev/null
+++ b/src/tools/json-to-schema/generate-schema.d.ts
@@ -0,0 +1,8 @@
+declare module 'generate-schema' {
+ function generic(jsonObject: object);
+ function mongoose(jsonObject: object);
+ function bigquery(jsonObject: object);
+ function json(title: string, jsonObject: object);
+ function mysql(tableName: string, jsonObject: object);
+ function clickhouse(tableName: string, jsonObject: object, dateField: string);
+}
\ No newline at end of file
diff --git a/src/tools/json-to-schema/index.ts b/src/tools/json-to-schema/index.ts
new file mode 100644
index 00000000..5252c6a2
--- /dev/null
+++ b/src/tools/json-to-schema/index.ts
@@ -0,0 +1,12 @@
+import { Braces } from '@vicons/tabler';
+import { defineTool } from '../tool';
+
+export const tool = defineTool({
+ name: 'Json to Schema',
+ path: '/json-to-schema',
+ description: 'Convert JSON data to JSON Schema, MySQL DDL, Mongoose Schema, Google BigQuery schema or ClickHouse Table Schema',
+ keywords: ['json', 'schema', 'mysql', 'sql', 'ddl', 'mongoose', 'bigquery', 'clickhouse', 'table'],
+ component: () => import('./json-to-schema.vue'),
+ icon: Braces,
+ createdAt: new Date('2024-05-11'),
+});
diff --git a/src/tools/json-to-schema/json-to-schema.vue b/src/tools/json-to-schema/json-to-schema.vue
new file mode 100644
index 00000000..18e382e2
--- /dev/null
+++ b/src/tools/json-to-schema/json-to-schema.vue
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+