Registry / serialization / jsonschema-typed-v2

jsonschema-typed-v2

JSON →
library0.8.0pypypi✓ verified 80d ago

Automatic type annotations from JSON schemas. Generate Python dataclasses with type hints from JSON Schema definitions. Version 0.8.0 is the latest. Release cadence is irregular; last release was in 2020. Requires Python >=3.7.

pip install jsonschema-typed-v2
INSTALL
IMPORT
SIG · JSONSCHEMA-TYPED-V
J
jsonschema-typed-v2
serializationpythonv0.8.0
Install
4.3s avg
Import
Disk
83MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 85.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.3s · import 0.000s · 83MB
83MB installed
● package 83MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Awesome
from jsonschema_typed import Awesome
from jsonschema_typed import from_schema
JSONSchema
from jsonschema_typed import JSONSchema
from jsonschema_typed import from_schema
OptionalTypedDict
from jsonschema_typed import OptionalTypedDict
from jsonschema_typed import from_schema

Define a dataclass from a JSON schema docstring.

from jsonschema_typed import JSONSchema @JSONSchema class MySchema: ''' { "type": "object", "properties": { "name": {"type": "string"}, "age": {"type": "integer"} }, "required": ["name"] } ''' pass obj = MySchema(name="Alice", age=30) print(obj.name, obj.age)
Debug
Known issues
gotchaThe library uses a docstring based JSON schema. The schema must be a valid JSON string inside the docstring of the class.
fix
Ensure the docstring contains valid JSON without trailing commas, and is properly indented.
affects: all
deprecatedThe package name on PyPI is 'jsonschema-typed-v2', but the import is 'jsonschema_typed'. Users often install the wrong package or try to import using hyphens.
fix
Install with pip install jsonschema-typed-v2, then import with from jsonschema_typed import ...
affects: all
gotchaDoes not support JSON Schema drafts beyond draft-07. Features like if/then/else or 2020-12 vocabulary may not work.
fix
Convert schema to draft-07 or use another library.
affects: 0.8.0
Upgrade
Version history
0.8.0latest on PyPI · released Aug 11, 2020
Audit
Dependencies
jsonschemarequiredRuntime dependency for schema validation.
typing-extensionsrequiredBackport of typing features for Python <3.10.
Agent activity
2 hits · last 30 days
node
2
Resources
jsonschema-typed-v2 — pip install jsonschema-typed-v2 · libregistry