jsonschema_diff.pypi_interface

Thin wrapper that exposes a simpler, Pandas-free API for PyPI users.

It delegates heavy lifting to jsonschema_diff.core.Property and applies optional ANSI-color highlighting.

Classes

JsonSchemaDiff

Facade around the low-level diff engine.

Module Contents

class JsonSchemaDiff(
config: Config,
colorize_pipeline: HighlighterPipeline,
legend_ignore: list[type[Compare]] | None = None,
)[source]

Facade around the low-level diff engine.

Call sequence

  1. compare() or compare_from_files()

  2. render() → string (kept in last_render_output)

  3. legend() → legend table (uses last_compare_list)

config: Config[source]
colorize_pipeline: HighlighterPipeline[source]
table_maker: LegendRenderer[source]
legend_ignore: list[type[Compare]] = [][source]
last_render_output: str = ''[source]
last_compare_list: list[type[Compare]] = [][source]
static fast_pipeline(
config: Config,
old_schema: dict | str,
new_schema: dict | str,
colorize_pipeline: HighlighterPipeline | None,
) tuple[str, list[type[Compare]]][source]

One-shot utility: compare old_schema vs new_schema and return (rendered_text, compare_list).

Accepted formats: dict or path to JSON file.

compare(
old_schema: dict | str,
new_schema: dict | str,
) JsonSchemaDiff[source]

Populate internal Property tree and perform comparison.

Accepted formats: dict or path to JSON file.

rich_render() Text[source]

Return the diff body ANSI-colored.

Side effects

  • self.last_render_output – cached rendered text.

  • self.last_compare_list – list of Compare subclasses encountered.

render() str[source]

Return the diff body ANSI-colored.

Side effects

  • self.last_render_output – cached rendered text.

  • self.last_compare_list – list of Compare subclasses encountered.

rich_legend(
comparators: list[type[Compare]],
) Table[source]

Return a legend table filtered by self.legend_ignore.

legend(
comparators: list[type[Compare]],
) str[source]

Return a legend table filtered by self.legend_ignore.

print(
*,
with_body: bool = True,
with_legend: bool = True,
) None[source]

Pretty-print the diff and/or the legend.

Parameters:
  • colorized (bool) – Apply ANSI colors to both body and legend.

  • with_body (bool) – Toggle respective sections.

  • with_legend (bool) – Toggle respective sections.