-
Notifications
You must be signed in to change notification settings - Fork 249
Added json schema for 0.8 version #1617
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
Conversation
.schema/0.8.schema.json
Outdated
"required": [ | ||
"init_hook" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"packages", | ||
"shell" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put these fields as required, If they're wrong or missing something lmk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I've been wanting this for a while. I left some wording suggestions, but feel free to take them or leave them as you see fit.
Question about the schema versioning - could we have a single schema.json and just link to specific commits in GitHub? For example, https://github.com/jetpack-io/devbox/blob/0.8.1/.schema/0.8.schema.json would return the schema as of devbox 0.8.1.
.schema/0.8.schema.json
Outdated
"type": "object", | ||
"properties": { | ||
"packages": { | ||
"description": "A specification of packages to be installed via devbox.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "A specification of packages to be installed via devbox.", | |
"description": "Collection of packages to install", |
.schema/0.8.schema.json
Outdated
"patternProperties": { | ||
".*": { | ||
"type": "string", | ||
"description": "Version number of the package in this object." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "Version number of the package in this object." | |
"description": "Version of the package to install." |
.schema/0.8.schema.json
Outdated
"patternProperties": { | ||
".*": { | ||
"type": "object", | ||
"description": "Version number of the specified package in {\"version\": \"1.2.3\"} formmat.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This object can contain a few more fields. I think they are:
- version
- platforms - only install the package on these Nix systems (e.g.,
aarch64-darwin
,x86_64-linux
, etc.) - excluded_platforms - don't install the package on these Nix systems.
- glibc_patch - apply the glibc-patch feature to this package's binaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gcurtis can you send me an example of devbox.json with these parameters included?
Also a list of all possible values for platforms/excluded_platforms.
Side note: If I remember correctly, platforms and excluded_platforms can not co-exist right?
.schema/0.8.schema.json
Outdated
"patternProperties": { | ||
".*": { | ||
"type": "object", | ||
"description": "Version number of the specified package in {\"version\": \"1.2.3\"} formmat.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "Version number of the specified package in {\"version\": \"1.2.3\"} formmat.", | |
"description": "Version number of the specified package in {\"version\": \"1.2.3\"} format.", |
.schema/0.8.schema.json
Outdated
] | ||
}, | ||
"env": { | ||
"description": "List of additional environment variables to be set in devbox shell. Values can contain $PATH and $PWD.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "List of additional environment variables to be set in devbox shell. Values can contain $PATH and $PWD.", | |
"description": "List of additional environment variables to be set in the Devbox environment. Values containing $PATH or $PWD will be expanded. No other variable expansion or command substitution will occur.", |
.schema/0.8.schema.json
Outdated
"description": "Definitions of scripts and actions to take when in devbox shell.", | ||
"type": "object", | ||
"properties": { | ||
"init_hook": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be a single string.
.schema/0.8.schema.json
Outdated
} | ||
}, | ||
"scripts": { | ||
"description": "List of commads/scripts definitions to run with `devbox run <script_name>` command.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "List of commads/scripts definitions to run with `devbox run <script_name>` command.", | |
"description": "List of command/script definitions to run with `devbox run <script_name>`.", |
.schema/0.8.schema.json
Outdated
"init_hook": { | ||
"type": "array", | ||
"items": { | ||
"description": "list of shell commands/scripts to run right after devbox shell starts.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "list of shell commands/scripts to run right after devbox shell starts.", | |
"description": "List of shell commands/scripts to run right after devbox shell starts.", |
.schema/0.8.schema.json
Outdated
], | ||
"items": { | ||
"type": "string", | ||
"description": "command/script to run as part of a list of commands defined here." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "command/script to run as part of a list of commands defined here." | |
"description": "The script's shell commands." |
.schema/0.8.schema.json
Outdated
"required": [ | ||
"init_hook" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"packages", | ||
"shell" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these required? I thought an empty devbox.json object was valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't know. I'll test it out and if they weren't I'll remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like empty devbox shell is accepted. I'll remove the required fields
@gcurtis |
@mohsenari it should be possible to get the raw content. For example, https://raw.githubusercontent.com/jetpack-io/devbox/ab2e606cc3c71b9f84d92d1d22441b6b400bf959/.schema/0.8.schema.json |
"platform": {}, | ||
"excluded_platform": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should be platforms
and excluded_platforms
(note the s
for plural)
Summary
Title says it.
I put the file in
.schema/
directory so that in future if we change the schema we can align it with version. Meaning, we can add new schema files with version numbers and enforce the schema based on the version of devbox a user has installed. Putting it in root of this repository would make the root too crowded especially if we add more schema files.I'm going to host our schema in this repository and subsequently send a PR to https://github.com/SchemaStore/schemastore/ with a link to the schema file in our repo to register our repo in https://schemastore.org
afterwards, I can update the vscode extension to reference the schemastore.org link and enforce our defined schema on files that are named
devbox.json
How was it tested?
validated schema and examples of devbox.json in https://www.jsonschemavalidator.net/