sourcemeta-jsonschema 14.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ recursive-include sourcemeta_jsonschema *.exe
3
+ recursive-include sourcemeta_jsonschema jsonschema-*
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: sourcemeta_jsonschema
3
+ Version: 14.0.2
4
+ Summary: The CLI for working with JSON Schema. Covers formatting, linting, testing, and much more for both local development and CI/CD pipelines
5
+ Home-page: https://github.com/sourcemeta/jsonschema
6
+ Author: Sourcemeta
7
+ Author-email: hello@sourcemeta.com
8
+ License: AGPL-3.0
9
+ Requires-Python: >=3.7
10
+ Dynamic: author
11
+ Dynamic: author-email
12
+ Dynamic: home-page
13
+ Dynamic: license
14
+ Dynamic: requires-python
15
+ Dynamic: summary
@@ -0,0 +1,240 @@
1
+ ![JSON Schema](./assets/banner.png)
2
+
3
+ [![GitHub Release](https://img.shields.io/github/v/release/sourcemeta/jsonschema)](https://github.com/sourcemeta/jsonschema/releases)
4
+ [![NPM Version](https://img.shields.io/npm/v/@sourcemeta/jsonschema)](https://www.npmjs.com/package/@sourcemeta/jsonschema)
5
+ [![NPM Downloads](https://img.shields.io/npm/dm/%40sourcemeta%2Fjsonschema)](https://www.npmjs.com/package/@sourcemeta/jsonschema)
6
+ [![PyPI Version](https://img.shields.io/pypi/v/sourcemeta-jsonschema.svg)](https://pypi.org/project/sourcemeta-jsonschema)
7
+ [![GitHub Actions](https://github.com/sourcemeta/jsonschema/actions/workflows/test.yml/badge.svg)](https://github.com/sourcemeta/jsonschema/actions)
8
+ [![GitHub contributors](https://img.shields.io/github/contributors/sourcemeta/jsonschema.svg)](https://github.com/sourcemeta/jsonschema/graphs/contributors/)
9
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/sourcemeta/jsonschema/blob/main/.pre-commit-hooks.yaml)
10
+
11
+ [![Get it from the Snap Store](https://snapcraft.io/en/light/install.svg)](https://snapcraft.io/jsonschema)
12
+
13
+ The command-line tool for working with [JSON Schema](https://json-schema.org),
14
+ the world most popular schema language. It is a comprehensive solution for
15
+ maintaining **repositories of schemas** and ensuring their quality, both during
16
+ local development and when running on CI/CD pipelines. For example:
17
+
18
+ - Ensure your schemas are valid
19
+ - Debug unexpected schema validation results
20
+ - Unit test your schemas against valid and invalid instances
21
+ - Enforce consistent indentation and keyword ordering in your schema files
22
+ - Detect and fix common JSON Schema anti-patterns
23
+ - Inline external references for conveniently distributing your schemas
24
+
25
+ [**Check out the documentation to learn more**](#usage)
26
+
27
+ ***
28
+
29
+ > [!TIP]
30
+ > Do you want to level up your JSON Schema skills? Check out
31
+ > [learnjsonschema.com](https://www.learnjsonschema.com), our growing JSON
32
+ > Schema documentation website, our [JSON Schema for
33
+ > OpenAPI](https://www.sourcemeta.com/courses/jsonschema-for-openapi) video
34
+ > course, and our O'Reilly book [Unifying Business, Data, and Code: Designing
35
+ > Data Products with JSON
36
+ > Schema](https://www.oreilly.com/library/view/unifying-business-data/9781098144999/).
37
+
38
+ ***
39
+
40
+ ![JSON Schema CLI Example](./assets/example.png)
41
+
42
+ Version support
43
+ ---------------
44
+
45
+ We aim to fully support _every_ version of JSON Schema and combinations between them.
46
+
47
+ | Dialect | Support |
48
+ |---------------------|-------------------------------------------------------|
49
+ | JSON Schema 2020-12 | **Full** |
50
+ | JSON Schema 2019-09 | **Full** |
51
+ | JSON Schema Draft 7 | **Full** |
52
+ | JSON Schema Draft 6 | **Full** |
53
+ | JSON Schema Draft 4 | **Full** |
54
+ | JSON Schema Draft 3 | Partial (except `validate`, `test`, and `metaschema`) |
55
+ | JSON Schema Draft 2 | Partial (except `validate`, `test`, and `metaschema`) |
56
+ | JSON Schema Draft 1 | Partial (except `validate`, `test`, and `metaschema`) |
57
+ | JSON Schema Draft 0 | Partial (except `validate`, `test`, and `metaschema`) |
58
+
59
+ What our users are saying
60
+ -------------------------
61
+
62
+ > Amazing product. Very useful for formatting and bundling my schemas, plus it
63
+ > surfaced various referencing issues. 10 out of 10!
64
+
65
+ [@alombarte](https://github.com/alombarte), co-founder of the
66
+ [KrakenD](https://www.krakend.io) API Gateway.
67
+
68
+ Usage
69
+ -----
70
+
71
+ The functionality provided by the JSON Schema CLI is divided into commands. The
72
+ following pages describe each feature in detail. Additionally, running the JSON
73
+ Schema CLI without passing a command will print convenient reference
74
+ documentation:
75
+
76
+ - [`jsonschema version`](./docs/version.markdown)
77
+ - [`jsonschema validate`](./docs/validate.markdown)
78
+ - [`jsonschema metaschema`](./docs/metaschema.markdown) (ensure a schema is valid)
79
+ - [`jsonschema compile`](./docs/compile.markdown) (for pre-compiling schemas)
80
+ - [`jsonschema test`](./docs/test.markdown) (write unit tests for your schemas)
81
+ - [`jsonschema fmt`](./docs/format.markdown)
82
+ - [`jsonschema lint`](./docs/lint.markdown)
83
+ - [`jsonschema bundle`](./docs/bundle.markdown) (for inlining remote references in a schema)
84
+ - [`jsonschema inspect`](./docs/inspect.markdown) (for debugging references)
85
+ - [`jsonschema canonicalize`](./docs/canonicalize.markdown) (for static analysis)
86
+ - [`jsonschema encode`](./docs/encode.markdown) (for binary compression)
87
+ - [`jsonschema decode`](./docs/decode.markdown)
88
+
89
+ > See [`jsonschema.json`](./docs/configuration.markdown) for an _experimental_
90
+ manifest for describing JSON Schema data models inspired by NPM's
91
+ `package.json`.
92
+
93
+ Note that YAML is supported in most commands!
94
+
95
+ We also support a growing amount of [`pre-commit`](https://pre-commit.com)
96
+ hooks. Take a look at the
97
+ [`.pre-commit-hooks.yaml`](https://github.com/sourcemeta/jsonschema/blob/main/.pre-commit-hooks.yaml)
98
+ configuration file for what's available right now. Keep in mind that to use the
99
+ `pre-commit` hooks, you need to install the CLI first.
100
+
101
+ ***
102
+
103
+ If you are looking for more of a tutorial and overview of what the CLI is
104
+ capable of, take a look at the [Applying software engineering practices to JSON
105
+ Schemas](https://www.youtube.com/watch?v=wJ7bK22n3IU) talk from the 2024 [JSON
106
+ Schema Conference](https://conference.json-schema.org). It covers advise on
107
+ ontology design, linting, unit testing, CI/CD integration, and more:
108
+
109
+ [![JSON Schema Conference 2024 - Applying software engineering practices to JSON Schemas](https://img.youtube.com/vi/wJ7bK22n3IU/0.jpg)](https://www.youtube.com/watch?v=wJ7bK22n3IU)
110
+
111
+ Installation
112
+ ------------
113
+
114
+ The JSON Schema CLI is written using C++ and [CMake](https://cmake.org/), and
115
+ supports macOS, Windows, and GNU/Linux.
116
+
117
+ ### From Homebrew
118
+
119
+ ```sh
120
+ brew install sourcemeta/apps/jsonschema
121
+ ```
122
+
123
+ ### From GitHub Actions
124
+
125
+ ```yaml
126
+ - uses: sourcemeta/jsonschema@vX.Y.Z
127
+ ```
128
+
129
+ Where `X.Y.Z` is replaced with the desired version. For example:
130
+
131
+ ```yaml
132
+ - name: Checkout Repository
133
+ uses: actions/checkout@v4
134
+
135
+ - name: Install the JSON Schema CLI
136
+ uses: sourcemeta/jsonschema@v14.0.2
137
+
138
+ # Then use as usual
139
+ - run: jsonschema fmt path/to/schemas --check
140
+ ```
141
+
142
+ ### From npm
143
+
144
+ ```sh
145
+ npm install --global @sourcemeta/jsonschema
146
+ ```
147
+
148
+ ### From PyPI
149
+
150
+ ```sh
151
+ pip install sourcemeta-jsonschema
152
+ ```
153
+
154
+ ### From mise
155
+
156
+ ```sh
157
+ mise use jsonschema
158
+ ```
159
+
160
+ ### From GitHub Releases
161
+
162
+ We publish precompiled binaries for every supported platform to [GitHub
163
+ Releases](https://github.com/sourcemeta/jsonschema/releases), including a
164
+ [continuous](https://github.com/sourcemeta/jsonschema/releases/tag/continuous)
165
+ that is updated on every commit from the main branch.
166
+
167
+ For convenience, we also provide a POSIX shell script capable of installing the
168
+ latest pre-built binaries, which you can run as follows:
169
+
170
+ ```sh
171
+ curl -fsSL https://raw.githubusercontent.com/sourcemeta/jsonschema/main/install -H 'Cache-Control: no-cache, no-store, must-revalidate' | /bin/sh
172
+ ```
173
+
174
+ Keep in mind that it is hard to provide binaries that work across GNU/Linux
175
+ distributions, given they often have major differences such as C runtimes (GLIC
176
+ vs MUSL). We conservatively target Ubuntu 22.04, but you might need to build
177
+ from source if your distribution of choice is different.
178
+
179
+ To verify the GPG signature of the checksums file:
180
+
181
+ ```sh
182
+ curl --silent --show-error --location 'https://www.sourcemeta.com/gpg.asc' | gpg --import
183
+ gpg --verify CHECKSUMS.txt.asc CHECKSUMS.txt
184
+ ```
185
+
186
+ ### From Dockerfile
187
+
188
+ Starting from v7.2.1, we publish a Docker image to [GitHub
189
+ Packages](https://github.com/sourcemeta/jsonschema/pkgs/container/jsonschema)
190
+ (`amd64` and `arm64`), which you can use as follows:
191
+
192
+ ```sh
193
+ docker run --interactive --volume "$PWD:/workspace" \
194
+ ghcr.io/sourcemeta/jsonschema:vX.Y.Z lint --verbose myschema.json
195
+ ```
196
+
197
+ Replace `vX.Y.Z` with your desired version. You can mount any directory as `/workspace`.
198
+
199
+ > [!WARNING]
200
+ > Make sure to NOT allocate a pseudo-TTY when running the CLI through Docker
201
+ > (i.e. the `--tty`/`-t` option) as it might result in line ending
202
+ > incompatibilities between the container and host, which will affect
203
+ > formatting. Plus a TTY is not required for running a tool like the JSON
204
+ > Schema CLI.
205
+
206
+ ### From Snap
207
+
208
+ Starting from v10.0.0, we publish to the Snap store:
209
+
210
+ ```sh
211
+ sudo snap install jsonschema
212
+ ```
213
+
214
+ Keep in mind that due to [Snap
215
+ confinement](https://snapcraft.io/docs/snap-confinement) requirements, the Snap
216
+ is only able to access files under your `$HOME` directory.
217
+
218
+ ### With gah
219
+
220
+ If you are using [gah](https://github.com/marverix/gah):
221
+
222
+ ```sh
223
+ gah install jsonschema
224
+ ```
225
+
226
+ gah does not require sudo, but you need to have `$HOME/.local/bin/` in your `PATH`.
227
+
228
+ ### Building from source
229
+
230
+ ```sh
231
+ git clone https://github.com/sourcemeta/jsonschema
232
+ cd jsonschema
233
+ cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=Release
234
+ cmake --build ./build --config Release --parallel 4
235
+ cmake --install ./build --prefix <prefix> \
236
+ --config Release --verbose --component sourcemeta_jsonschema
237
+ ```
238
+
239
+ Where `<prefix>` can be any destination prefix of your choosing, such as `/opt`
240
+ or `/usr/local`.
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,22 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name = "sourcemeta_jsonschema",
5
+ version = "14.0.2",
6
+ description = "The CLI for working with JSON Schema. Covers formatting, linting, testing, and much more for both local development and CI/CD pipelines",
7
+ author = "Sourcemeta",
8
+ author_email = "hello@sourcemeta.com",
9
+ url = "https://github.com/sourcemeta/jsonschema",
10
+ license = "AGPL-3.0",
11
+ packages = find_packages(),
12
+ include_package_data = True,
13
+ package_data = {
14
+ "sourcemeta_jsonschema": ["*.exe", "jsonschema-*"]
15
+ },
16
+ python_requires = ">=3.7",
17
+ entry_points = {
18
+ "console_scripts": [
19
+ "jsonschema = sourcemeta_jsonschema.__main__:main"
20
+ ]
21
+ }
22
+ )
@@ -0,0 +1,20 @@
1
+ import os, platform, subprocess, sys
2
+
3
+ def main():
4
+ arch_map = {
5
+ 'amd64': 'x86_64'
6
+ }
7
+
8
+ system = platform.system().lower()
9
+ arch = platform.machine().lower()
10
+ arch = arch_map.get(arch, arch)
11
+ key = f"{system}-{arch}"
12
+ fn = f"jsonschema-{key}.exe" if system=="windows" else f"jsonschema-{key}"
13
+ path = os.path.join(os.path.dirname(__file__), fn)
14
+ if not os.path.exists(path):
15
+ print(f"Unsupported platform: {key}", file=sys.stderr)
16
+ sys.exit(1)
17
+ subprocess.run([path]+sys.argv[1:], check=True)
18
+
19
+ if __name__=="__main__":
20
+ main()
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: sourcemeta_jsonschema
3
+ Version: 14.0.2
4
+ Summary: The CLI for working with JSON Schema. Covers formatting, linting, testing, and much more for both local development and CI/CD pipelines
5
+ Home-page: https://github.com/sourcemeta/jsonschema
6
+ Author: Sourcemeta
7
+ Author-email: hello@sourcemeta.com
8
+ License: AGPL-3.0
9
+ Requires-Python: >=3.7
10
+ Dynamic: author
11
+ Dynamic: author-email
12
+ Dynamic: home-page
13
+ Dynamic: license
14
+ Dynamic: requires-python
15
+ Dynamic: summary
@@ -0,0 +1,15 @@
1
+ MANIFEST.in
2
+ README.md
3
+ setup.py
4
+ sourcemeta_jsonschema/__init__.py
5
+ sourcemeta_jsonschema/__main__.py
6
+ sourcemeta_jsonschema/jsonschema-darwin-arm64
7
+ sourcemeta_jsonschema/jsonschema-darwin-x86_64
8
+ sourcemeta_jsonschema/jsonschema-linux-arm64
9
+ sourcemeta_jsonschema/jsonschema-linux-x86_64
10
+ sourcemeta_jsonschema/jsonschema-windows-x86_64.exe
11
+ sourcemeta_jsonschema.egg-info/PKG-INFO
12
+ sourcemeta_jsonschema.egg-info/SOURCES.txt
13
+ sourcemeta_jsonschema.egg-info/dependency_links.txt
14
+ sourcemeta_jsonschema.egg-info/entry_points.txt
15
+ sourcemeta_jsonschema.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ jsonschema = sourcemeta_jsonschema.__main__:main
@@ -0,0 +1 @@
1
+ sourcemeta_jsonschema