Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support command line interface #49

Open
doganulus opened this issue Feb 9, 2024 · 1 comment
Open

Support command line interface #49

doganulus opened this issue Feb 9, 2024 · 1 comment

Comments

@doganulus
Copy link

I like to use the Hyperjump's bundle functionality like this one:
https://libraries.io/npm/@skriptfabrik%2Fjson-schema-bundler

Does the library currently support the command line interface?

@jdesrosiers
Copy link
Collaborator

There isn't a CLI, but it wouldn't be hard to make one. Unfortunately, I don't have to time to work on something like that at the moment. I'd be thrilled if someone wanted to contribute a proper cli wrapper, but here's a quick and dirty example if you something urgently.

import "@hyperjump/json-schema/draft-2020-12";
import { bundle } from "@hyperjump/json-schema/bundle";


const mainSchema = process.argv[2];

const result = await bundle(mainSchema);
console.log(JSON.stringify(result, null, "  "));

Just pass the initial schema and it will send the bundled schema to stdout: node bundle-cli.js main.schema.json. This example works for file-based schemas. If you need to register schemas that use $id, you'd have to expand on the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants