Skip to content

[FEATURE]: Allow CLI users to specify alternate top-level schema (json schema draft) #2690

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

Open
katylava opened this issue Mar 12, 2025 · 0 comments

Comments

@katylava
Copy link

Context (Input, Language)

Using the CLI to get a schema file from a json file.

Input Format: JSON
Output Language: Schema

Description

I want to make it easy for my team to document their services' message structure with json schema. I am hoping they can use the quicktype cli to do this, given an example message as a json file. However, I want use to use the 2020-12 draft of json schema. We have hundreds of services that each send a few different kinds of messages, so it's quite a bit of work to do manually.

I realize they will need to edit the resulting file anyway, to tweak formats and required fields and such, but I would prefer if they didn't have to remember to update the top-level $schema as well.

Current Behaviour / Output

 ❧ quicktype --lang schema --src-lang json -o pubsub-topic-name.schema.json pubsub-topic-name.sample.json
 ❧ head -n2 pubsub-topic-name.schema.json
{
    "$schema": "http://json-schema.org/draft-06/schema#",

Proposed Behaviour / Output

 ❧ quicktype --lang schema --src-lang json --schema draft/2020-12 -o pubsub-topic-name.schema.json pubsub-topic-name.sample.json
 ❧ head -n2 pubsub-topic-name.schema.json
{
    "$schema": "http://json-schema.org/draft/2020-12/schema#",

... or something like that for the option. Maybe it would be better to provide the full URL. I don't know what the possibilities are.

Solution

???

Alternatives

Relying on humans to remember to change it. Humans are not always good at such things.

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

No branches or pull requests

1 participant