Metadata-Version: 2.5
Name: schematalog-core
Version: 0.1.1
Summary: The Schematalog domain contract and its conformance suite.
Project-URL: Homepage, https://schematalog.com
Project-URL: Documentation, https://schematalog.com
Project-URL: Source, https://github.com/schematalog/schematalog
Author-email: Berislav Lopac <berislav@lopac.net>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Requires-Python: ~=3.14.0
Requires-Dist: jsonschema>=4.23.0
Requires-Dist: pydantic>=2.9.0
Requires-Dist: sanitary>=0.2.1
Requires-Dist: unclogger>=0.2.2
Provides-Extra: testing
Requires-Dist: pytest-asyncio>=0.23; extra == 'testing'
Requires-Dist: pytest>=8.0; extra == 'testing'
Description-Content-Type: text/markdown

# schematalog-core

The domain contract for [Schematalog](https://schematalog.com), a registry and catalog
for JSON Schema specifications — and the conformance suite that goes with it.

**This is what a storage backend codes against.** It deliberately does not depend on the
registry application, so implementing a backend does not oblige you to install a web
framework.

```shell
pip install schematalog-core[testing]
```

## Writing a storage backend

A backend implements five methods — `add`, `get`, `set_metadata`, `list_versions` and
`list_names`. Three more (`get_latest`, `list_latest`, `list_predecessors`) are derived
for you by `SchemaRepository`, including the rule for which version counts as *latest*,
so you inherit that rather than reimplementing it. Override them only if your store can
answer them better.

The contract is written as tests. Subclass it, supply one fixture yielding an empty
repository, and it tells you whether your backend is correct:

```python
import pytest
from schematalog.testing import SchemaRepositoryConformance

class TestMyBackend(SchemaRepositoryConformance):
    @pytest.fixture
    def repository(self):
        return MyRepository(...)
```

Registration is a `schematalog.storage` entry point naming the URL scheme you answer to;
nothing in the registry needs changing. See
[`schematalog-s3`](https://pypi.org/project/schematalog-s3/) for a complete worked
example.

## What it contains

- `schematalog.domain` — `Schema`, `SchemaRepository`, the value objects and errors.
- `schematalog.testing` — the conformance suite and a sample schema to test with.
- `schematalog.common` — layer-neutral helpers, including a dependency-free JSON Schema
  ↔ Avro converter.
