File size: 402 Bytes
b664585
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import { readFileSync } from "fs"
import { SchemaConverter } from "../examples/server/public_legacy/json-schema-to-grammar.mjs"

const [, , file] = process.argv
const url = `file://${file}`
let schema = JSON.parse(readFileSync(file, "utf8"));
const converter = new SchemaConverter({})
schema = await converter.resolveRefs(schema, url)
converter.visit(schema, '')
console.log(converter.formatGrammar())