jsonschema_diff¶
Submodules¶
Classes¶
Helper that builds a fully populated |
|
Facade around the low-level diff engine. |
Package Contents¶
- class ConfigMaker[source]¶
Helper that builds a fully populated
Config.- static make(
- *,
- tab_size: int = 1,
- all_for_rendering: bool = False,
- crop_path: bool = True,
- path_render_with_properies: bool = False,
- path_render_with_items: bool = False,
- list_comparator: bool = True,
- list_multiline_render: MultilineListRender = MultilineListRender.Soft,
- range_digit_comparator: bool = True,
- range_length_comparator: bool = True,
- range_items_comparator: bool = True,
- range_properties_comparator: bool = True,
- additional_compare_rules: jsonschema_diff.core.tools.compare.COMPARE_RULES_TYPE = {},
- additional_combine_rules: jsonschema_diff.core.tools.combine.COMBINE_RULES_TYPE = [],
- additional_pair_context_rules: jsonschema_diff.core.tools.context.PAIR_CONTEXT_RULES_TYPE = [],
- additional_context_rules: jsonschema_diff.core.tools.context.CONTEXT_RULES_TYPE = {},
- additional_path_maker_ignore: jsonschema_diff.core.tools.render.PATH_MAKER_IGNORE_RULES_TYPE = [],
Assemble and return a
Config.- Parameters:
tab_size (int) – Number of spaces per indentation level.
path_render_with_properies (bool) – Include these schema service tokens in rendered paths.
path_render_with_items (bool) – Include these schema service tokens in rendered paths.
list_comparator (bool) – Enable
CompareList.list_multiline_render (MultilineListRender) – How to render multi-line elements of list.
range_*_comparator (bool) – Enable
CompareRangefor numeric/length/items/properties limits.additional_* (collections) – User-supplied rules that override the built-ins.
- class JsonSchemaDiff(
- config: Config,
- colorize_pipeline: HighlighterPipeline,
- legend_ignore: list[type[Compare]] | None = None,
Facade around the low-level diff engine.
Call sequence¶
compare()orcompare_from_files()render()→ string (kept in last_render_output)legend()→ legend table (uses last_compare_list)
- colorize_pipeline: HighlighterPipeline¶
- table_maker: LegendRenderer¶
- static fast_pipeline(
- config: Config,
- old_schema: dict | str,
- new_schema: dict | str,
- colorize_pipeline: HighlighterPipeline | None,
One-shot utility: compare old_schema vs new_schema and return
(rendered_text, compare_list).Accepted formats: dict or path to JSON file.
- compare( ) JsonSchemaDiff[source]¶
Populate internal
Propertytree 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.