This is the jsonschema module bundled for usage with Package Control, a package manager for the Sublime Text text editor.
| this repo | pypi |
|---|---|
In order to tell Package Control
that you are using the jsonschema module
in your ST package,
create a dependencies.json file
in your package root
with the following contents:
{
"*": {
"*": [
"sublime-jsonschema"
]
}
}If the file exists already, add the above entry to the very dependency list.
Then run the Package Control: Satisfy Dependencies command to make Package Control install the module for you locally (if you don't have it already).
After all this
you can use import jsonschema
in any of your Python plugins.
In the example below we validate settings, which is an important use case.
from jsonschema.validators import validate
from jsonschema.exceptions import ValidationError
...
schema = sublime.decode_value(sublime.load_resource("path/to/schema_file.json"))
settings = sublime.decode_value(sublime.load_resource("path/to/my_plugin.sublime-settings"))
try:
validate(merged_settings, schema)
except ValidationError as ve:
print("Settings invalid.")
else:
print("Settings valid.")
See also: Documentation on Dependencies
- Download the latest tarball from pypi.
- Delete everything inside the
all/folder. - Copy the
jsonschema/folder and everything related to copyright/licensing from the tarball to theall/folder. - Adapt import paths for all python files.
- Commit changes
and either create a pull request
or create a tag directly
in the format
v<version>(in case you have push access).
The contents of the root folder
in this repository
are released
under the public domain.
The contents of the all/ folder
fall under their own bundled licenses.
