Skip to main content
Version: 1.31.0 (latest)

dlt.common.reflection.json_schema

JSON Schema of Python type hints, configspecs and TypedDicts.

TAnnotate​

Keywords an Annotated metadata item adds to a schema, or None when it adds none.

DATA_TYPE_SCHEMAS​

JSON Schema of each dlt data type a Python type maps to.

annotated_description​

def annotated_description(hint: Any) -> Optional[str]

View source on GitHub

Description an Annotated hint carries: a Doc marker, or a plain string.

json_default​

def json_default(value: Any) -> Any

View source on GitHub

value as a JSON Schema default, or None when it has no JSON form.

JsonSchemaBuilder Objects​

class JsonSchemaBuilder()

View source on GitHub

Builds JSON Schemas of type hints, collecting nested TypedDicts and configspecs in defs.

hint_schema​

def hint_schema(hint: Any) -> Dict[str, Any]

View source on GitHub

JSON Schema of hint, nested object types referenced from defs.

typed_dict_schema​

def typed_dict_schema(td: Any) -> Dict[str, Any]

View source on GitHub

Object schema of a TypedDict, NotRequired keys left out of required.

spec_schema​

def spec_schema(
spec: Type[BaseConfiguration], exclude: Collection[str] = ()
) -> Dict[str, Any]

View source on GitHub

Object schema of a configspec, one property per field configuration resolves.

root_schema​

def root_schema(hint: Any) -> Dict[str, Any]

View source on GitHub

Self-contained schema of hint, an object type inlined at the root.

with_defs​

def with_defs(schema: Dict[str, Any]) -> Dict[str, Any]

View source on GitHub

schema with the definitions it refers to, directly or through other definitions.

prune_unreferenced_defs​

def prune_unreferenced_defs(schema: Dict[str, Any]) -> None

View source on GitHub

Drops the $defs nothing points at, following the references between those kept.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.