{"id":22971,"library":"warchant-dc-schema","title":"dc_schema","description":"Generate JSON Schema from Python dataclasses. Version 0.0.10, requires Python >=3.9. Lightweight library with no runtime dependencies beyond Python standard library.","status":"active","version":"0.0.10","language":"python","source_language":"en","source_url":"https://github.com/Peter554/dc_schema","tags":["json-schema","dataclasses","schema-generation"],"install":[{"cmd":"pip install warchant-dc-schema","lang":"bash","label":"install"}],"dependencies":[],"imports":[{"note":"schema is a function exposed at package level, not a submodule.","wrong":"from dc_schema.schema import schema","symbol":"schema","correct":"from dc_schema import schema"}],"quickstart":{"code":"from dataclasses import dataclass\nfrom dc_schema import schema\n\n@dataclass\nclass User:\n    name: str\n    age: int\n\njson_schema = schema(User)\nprint(json_schema)","lang":"python","description":"Define a dataclass and call schema() to get its JSON Schema."},"warnings":[{"fix":"Manually annotate with typing.Annotated or use workarounds described in issue #2.","message":"The library does not support complex nested generics (e.g., List[Optional[int]]) properly. It may produce incorrect schemas for such types.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from __future__ import annotations` if you need string annotations, but ensure all types are importable.","message":"Forward references (strings) are not resolved; you must annotate with actual types, not strings.","severity":"gotcha","affected_versions":"<=0.0.10"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from dc_schema import schema` then `schema(MyDataclass)`.","cause":"Calling schema() without argument (common when trying to import incorrectly).","error":"TypeError: schema() missing 1 required positional argument: 'cls'"},{"fix":"Use `from dc_schema import schema`.","cause":"Trying to import from a wrong path or wrong package name (e.g., `from dc_schema.schema import schema`).","error":"AttributeError: module 'dc_schema' has no attribute 'schema'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}