jsonschema_diff.core.tools.render¶
Attributes¶
Classes¶
Small helper utilities used by the rendering subsystem. |
Module Contents¶
- class RenderTool[source]¶
Small helper utilities used by the rendering subsystem.
- static make_tab(
- config: jsonschema_diff.core.config.Config,
- tab_level: int,
Return indentation string.
- static make_prefix(
- status: jsonschema_diff.core.abstraction.Statuses,
Convert a
Statuses
enum value to its printable form.
- static make_path(
- schema_path: Sequence[Any],
- json_path: Sequence[Any],
- ignore: PATH_MAKER_IGNORE_RULES_TYPE = ('properties',),
Compose a human‑readable path by synchronising two parallel paths.
The function walks through schema_path (tokens from JSON Schema) and json_path (real path in the JSON instance) and emits a short textual representation such as
["items"][0].extra
.- Parameters:
schema_path (Sequence[Any]) – Tokens encountered while traversing the schema.
json_path (Sequence[Any]) – Path tokens from the actual JSON document.
ignore (Sequence[str], default (
"properties"
,)) – Schema‑only service tokens to skip.
- Returns:
str – Compact path string.
Algorithm
———
i — index in *schema_path, j — index in json_path.*
1. If *schema_path[i] is in ignore and differs from* – json_path[j] → skip it.
2. If tokens are equal → emit as property/index and advance both.
Otherwise the token exists only in schema → emit as
.token
and – advance i.
4. After the schema is exhausted, append remaining elements of – json_path.
Integer‑like tokens are rendered as
[n]
; everything else as["key"]
.