jsonschema_diff.core

Submodules

Classes

Statuses

Create a collection of name/value pairs.

ToCompare

Config

Compare

CompareCombined

Property

Package Contents

class Statuses(*args, **kwds)[source]

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

ADDED = '+'
DELETED = '-'
REPLACED = 'r'
MODIFIED = 'm'
NO_DIFF = ' '
UNKNOWN = '?'
class ToCompare(
old_key: str | None,
old_value: Any,
new_key: str | None,
new_value: Any,
)[source]
old_key
old_value
new_key
new_value
__repr__() str[source]
class Config(
tab: str = '  ',
compare_rules: jsonschema_diff.core.tools.compare.COMPARE_RULES_TYPE = {},
combine_rules: jsonschema_diff.core.tools.combine.COMBINE_RULES_TYPE = [],
path_maker_ignore: jsonschema_diff.core.tools.render.PATH_MAKER_IGNORE_RULES_TYPE = ['properties', 'items'],
pair_context_rules: jsonschema_diff.core.tools.context.PAIR_CONTEXT_RULES_TYPE = [],
context_rules: jsonschema_diff.core.tools.context.CONTEXT_RULES_TYPE = {},
)[source]
TAB = '  '
COMPARE_RULES
COMBINE_RULES = []
PATH_MAKER_IGNORE = ['properties', 'items']
PAIR_CONTEXT_RULES = []
CONTEXT_RULES
class Compare(
config: jsonschema_diff.core.config.Config,
schema_path: COMPARE_PATH_TYPE,
json_path: COMPARE_PATH_TYPE,
to_compare: list[ToCompare],
)[source]
status
config
schema_path
json_path
to_compare
compare() jsonschema_diff.core.abstraction.Statuses[source]
get_name() str[source]
is_for_rendering() bool[source]
render(tab_level: int = 0, with_path: bool = True) str[source]
static legend() LEGEND_RETURN_TYPE[source]
class CompareCombined(*args: Any, **kwargs: Any)[source]
dict_compare: Dict[str, ToCompare]
dict_values: Dict[str, Any]
compare() jsonschema_diff.core.abstraction.Statuses[source]
abstractmethod get_name() str[source]
abstractmethod render(tab_level: int = 0, with_path: bool = True) str[source]
static legend() jsonschema_diff.core.parameter_base.LEGEND_RETURN_TYPE[source]
Abstractmethod:

class Property(
config: jsonschema_diff.core.config.Config,
schema_path: list[str | int],
json_path: list[str | int],
name: str | int | None,
old_schema: dict | None,
new_schema: dict | None,
)[source]
status: jsonschema_diff.core.abstraction.Statuses
parameters: dict[str, jsonschema_diff.core.parameter_base.Compare]
propertys: dict[str | int, Property]
config
name
schema_path
json_path
old_schema
new_schema
property json_path_with_name: list[str | int]
property schema_path_with_name: list[str | int]
compare() None[source]
is_for_rendering() bool[source]
get_for_rendering() list[jsonschema_diff.core.parameter_base.Compare][source]
self_render(
tab_level: int = 0,
) tuple[str, list[type[jsonschema_diff.core.parameter_base.Compare]]][source]
render(
tab_level: int = 0,
) tuple[list[str], list[type[jsonschema_diff.core.parameter_base.Compare]]][source]