I have several JSON files: a.json
, b.json
, c.json
. Is there a tool that could generate one single JSON schema from these files? I am looking for a tool where I could use a command like tool --files a.json b.json c.json > merge.schema.json
.
Asked
Active
Viewed 544 times
1

tom redfern
- 30,562
- 14
- 91
- 126

ooj-001
- 180
- 9
-
2Inferring a schema from multiple instance documents is hard. Why not design your schema by hand? How many properties do your documents have in total? – tom redfern May 02 '19 at 14:34
-
The JSON files I process are huge; would creating a JSON schema for each file and creating one single JSON schema from every JSON schemas be better than what I wanted first? Something like `tool --files a.schema.json b.schema.json > ab.schema.json` ? – ooj-001 May 02 '19 at 14:43
-
2You should not do this and expect it to provide useful validation without doing a LOT of manual editing. Using such a tool would only provide you with a template, and it's likely to be wrong for your requirements, especially for large JSON files, as you say you have. Such tools are only useful for very small files to generate templates. – Relequestual May 02 '19 at 15:36
-
We have a case here where the monaco-yaml does not support $ref from other files. So we can not use a splitted json schemas: https://github.com/remcohaszing/monaco-yaml/issues/107 – Lyokolux Feb 07 '23 at 10:48