{"id":23916,"library":"jsonschema-typed-v2","title":"jsonschema-typed-v2","description":"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.","status":"maintenance","version":"0.8.0","language":"python","source_language":"en","source_url":"https://github.com/bsamseth/jsonschema-typed","tags":["json-schema","type-hints","dataclasses","code-generation"],"install":[{"cmd":"pip install jsonschema-typed-v2","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Runtime dependency for schema validation.","package":"jsonschema","optional":false},{"reason":"Backport of typing features for Python <3.10.","package":"typing-extensions","optional":false}],"imports":[{"note":"Import from 'jsonschema_typed', not the PyPI package name.","wrong":"from jsonschema_typed_v2 import from_schema","symbol":"from_schema","correct":"from jsonschema_typed import from_schema"},{"note":"JSONSchema is a decorator provided by this library, not by the base jsonschema package.","wrong":"from jsonschema import JSONSchema","symbol":"JSONSchema","correct":"from jsonschema_typed import JSONSchema"}],"quickstart":{"code":"from jsonschema_typed import JSONSchema\n\n@JSONSchema\nclass MySchema:\n    '''\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"name\": {\"type\": \"string\"},\n        \"age\": {\"type\": \"integer\"}\n      },\n      \"required\": [\"name\"]\n    }\n    '''\n    pass\n\nobj = MySchema(name=\"Alice\", age=30)\nprint(obj.name, obj.age)","lang":"python","description":"Define a dataclass from a JSON schema docstring."},"warnings":[{"fix":"Ensure the docstring contains valid JSON without trailing commas, and is properly indented.","message":"The library uses a docstring based JSON schema. The schema must be a valid JSON string inside the docstring of the class.","severity":"gotcha","affected_versions":"all"},{"fix":"Install with pip install jsonschema-typed-v2, then import with from jsonschema_typed import ...","message":"The 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.","severity":"deprecated","affected_versions":"all"},{"fix":"Convert schema to draft-07 or use another library.","message":"Does not support JSON Schema drafts beyond draft-07. Features like if/then/else or 2020-12 vocabulary may not work.","severity":"gotcha","affected_versions":"0.8.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from jsonschema_typed import JSONSchema' and apply @JSONSchema to your class.","cause":"Attempting to import 'from_schema' which does not exist; the correct API is the 'JSONSchema' decorator.","error":"ImportError: cannot import name 'from_schema' from 'jsonschema_typed'"},{"fix":"Ensure your JSON schema defines 'type': 'object' and that you pass valid data. Also check that required properties are present.","cause":"The generated class expects an object schema, or the provided data does not match the schema.","error":"jsonschema.exceptions.ValidationError: ... is not of type 'object'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}