Comparator Rules Page

Precedence tiers

  1. (keyword, old_type, new_type)

  2. keyword

  3. (old_type, new_type)

  4. old_type or new_type (single-sided)

  5. default comparator

Declaration

Add entries to Config.COMPARE_RULES; resolution is performed by CompareRules.get_comparator().

Extending

  1. Implement a Compare subclass.

  2. Register it in the rules table.

  3. (Optional) expose it via ConfigMaker so convenience constructors pick it up.

Per-comparator options

Some comparators support extra options via Config.COMPARE_CONFIG.

Example: CompareList reads DICT_MATCH_THRESHOLD (default 0.10) to decide how strict dict-to-dict matching inside arrays should be.

from jsonschema_diff.core import Config
from jsonschema_diff.core.custom_compare import CompareList

cfg = Config(
    compare_rules={
        list: CompareList,
    },
    compare_config={
        CompareList: {
            "DICT_MATCH_THRESHOLD": 0.25,
        },
    },
)