Pytest plugin for automatic JSON Schema generation and validation from examples
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
pytest: Typed Schema Shot
Plugin for pytest that automatically generates JSON Schemas based on data examples and validates data against saved schemas.
Плагин для pytest, который автоматически генерирует JSON Schema на основе примеров данных и проверяет данные по сохраненным схемам.
Features
-
Automatic JSON Schema generation from data examples (using the
gensonlibrary).Автоматическая генерация JSON Schema по примерам данных (на основе библиотеки
genson). -
Schema storage and management.
Хранение и управление схемами.
-
Validation of data against saved schemas.
Валидация данных по сохраненным схемам.
-
Schema update via
--schema-update(create new schemas, remove unused ones, update existing).Обновление схем через
--schema-update(создание новых, удаление неиспользуемых, обновление существующих). -
Support for both
asyncand synchronous functions.Поддержка асинхронных (
async) и синхронных функций. -
Support for
Uniontypes and optional fields.Поддержка
Unionтипов и опциональных полей.
Installation
pip install pytest-typed-schema-shot
Usage
-
Use the
schemashotfixture in your testsВ тестах используйте фикстуру
schemashot:from typed_schema_shot import SchemaShot @pytest.mark.asyncio async def test_something(schemashot: SchemaShot): data = await API.data() schemashot.assert_match(data, "data")
-
On first run, generate schemas with the
--schema-updateflagПри первом запуске создайте схемы
--schema-update:pytest --schema-update -
On subsequent runs, tests will validate data against saved schemas
В последующих запусках тесты будут проверять данные по сохраненным схемам:
pytest
Key Capabilities
-
Union Types: support multiple possible types for fields
Поддержка множественных типов полей.
-
Optional Fields: automatic detection of required and optional fields
Автоматическое определение обязательных и необязательных полей.
-
Cleanup: automatic removal of unused schemas when running in update mode
Автоматическое удаление неиспользуемых схем в режиме обновления.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_typed_schema_shot-0.1.1.tar.gz.
File metadata
- Download URL: pytest_typed_schema_shot-0.1.1.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17d22a512013b15a13bf21876d4f1b630557ce31ad2c786c6edba6cbcac60ea1
|
|
| MD5 |
a4cc500c4de245c0a078a46206e115ce
|
|
| BLAKE2b-256 |
8ace90bd0496888956733e880d9db7129fe3b1821527b6d67e9795699615e44f
|
Provenance
The following attestation bundles were made for pytest_typed_schema_shot-0.1.1.tar.gz:
Publisher:
python-publish.yml on Open-Inflation/pytest-typed-schema-shot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_typed_schema_shot-0.1.1.tar.gz -
Subject digest:
17d22a512013b15a13bf21876d4f1b630557ce31ad2c786c6edba6cbcac60ea1 - Sigstore transparency entry: 217191983
- Sigstore integration time:
-
Permalink:
Open-Inflation/pytest-typed-schema-shot@7420c62b243f051bade81939f962f94150cb21b0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Open-Inflation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7420c62b243f051bade81939f962f94150cb21b0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytest_typed_schema_shot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pytest_typed_schema_shot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
596733ecac40868d29e74585bec7ced2f1e61ed4c9878efe6bcb4065c14c8738
|
|
| MD5 |
d320e17ea1eba3d71890b93a3dcd7b55
|
|
| BLAKE2b-256 |
d1b5011dcc30e4736d04628c83be864676b83e5d173376ffdefd242f6841a5f2
|
Provenance
The following attestation bundles were made for pytest_typed_schema_shot-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on Open-Inflation/pytest-typed-schema-shot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_typed_schema_shot-0.1.1-py3-none-any.whl -
Subject digest:
596733ecac40868d29e74585bec7ced2f1e61ed4c9878efe6bcb4065c14c8738 - Sigstore transparency entry: 217191985
- Sigstore integration time:
-
Permalink:
Open-Inflation/pytest-typed-schema-shot@7420c62b243f051bade81939f962f94150cb21b0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Open-Inflation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7420c62b243f051bade81939f962f94150cb21b0 -
Trigger Event:
push
-
Statement type: