jsonschema_diff.core.tools.combine¶
Attributes¶
each inner list declares a logical group of keys. |
Classes¶
Group items by user-defined rules and merge their inner fields. |
Module Contents¶
- type COMBINE_RULES_TYPE = List[List[str]][source]¶
each inner list declares a logical group of keys.
- Type:
Rule format
- class LogicCombinerHandler[source]¶
Group items by user-defined rules and merge their inner fields.
- static combine(
- subset: Dict[str, Any],
- rules: List[List[str]],
- inner_key_field: str = 'comparator',
- inner_value_field: str = 'to_compare',
Build an
OrderedDict
that groups subset items per rules.- Returns:
(k1, k2, …) -> {inner_key_field: common_key, inner_value_field: [v1, v2, …]}
- Return type:
Note
Keys not covered by rules stay as single-element groups.
Inner keys in the same group must match or
ValueError
is raised.