Skip to content

Commit 2589583

Browse files
committed
Update the README docs.
1 parent 771713e commit 2589583

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

README.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
1-
# schemastorepy
1+
# schematore.py
22

3-
Contains all JSON Schemas from [schemastore.org](https://schemastore.org)
4-
catalog so you can make use of them without needing internet access.
3+
A collection of all JSON Schemas from the [schemastore.org](https://schemastore.org) catalog, installable so they may be used without internet access.
4+
5+
## Installation
6+
7+
Use your favorite package manager, e.g. via:
8+
9+
$ uv pip install schemastore
10+
11+
or
12+
13+
$ pip install schemastore
14+
15+
## Usage
16+
17+
Schemas are made usable as a [`referencing.Registry`](https://referencing.readthedocs.io/en/stable/api/#referencing.Registry).
18+
It is available as:
519

6-
## How to use
720

821
```python
9-
from schemastore import Store
22+
import schemastore
23+
registry = schemastore.registry()
24+
```
25+
26+
and use any of the API from the aforementioned referencing package to make use of the schemas, such as:
27+
28+
```python
29+
print(registry.get_or_retrieve("https://json.schemastore.org/github-action.json").value)
1030

11-
store = Store(days=30)
12-
my_schema_json = store.get('http://...') # <-- no network access happens
1331
```
1432

15-
The `days` parameter is optional and defaults to 30, which means that after
16-
this it will start checking if the locally cached schema is up to date and
17-
refresh it it needed. `store.catalog` would contain
18-
the content of the catalog itself.
33+
though more typically you will use the registry alongside a JSON Schema validator such as those provided by the [`jsonschema` library](https://python-jsonschema.readthedocs.io/):
34+
35+
```python
36+
import jsonschema
37+
import schemastore
1938

20-
## Stats
2139

22-
- Over 500 JSON Schemas in the catalog
23-
- ~2.5Mib package size
24-
- ~30Mib installed size
40+
# Validate whether the string "foo" is a valid GitHub actions workflow (it is not.)
41+
jsonschema.validate(
42+
'"foo"',
43+
{"$ref": "https://json.schemastore.org/github-action.json"},
44+
registry=schemastore.registry(),
45+
)
46+
```

0 commit comments

Comments
 (0)