Pointers
pointers
Bundle-local JSON Pointer validation.
Bundle-local references use RFC 6901 JSON Pointer syntax:
#/ marks the bundle root, ~0 escapes ~, and ~1 escapes /
within mapping keys.
For example:
* #/objects/item starts at the bundle root and selects item.
* #/objects/a~1b selects the key a/b.
* #/objects/a~0b selects the key a~b.
Functions:
decode_json_pointer_parts
Decode and validate the syntax of a local JSON Pointer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pointer
|
str
|
Bundle-local JSON Pointer beginning with |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Decoded JSON Pointer path segments. |
Raises:
| Type | Description |
|---|---|
BundlePointerResolutionError
|
If a path segment contains an
invalid |
parse_json_pointer_array_index
Parse a valid JSON Pointer array index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
part
|
str
|
Decoded JSON Pointer path segment addressing an array element. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The non-negative array index. |
Raises:
| Type | Description |
|---|---|
BundlePointerResolutionError
|
If |
validate_and_expand_bundle_references
Validate local pointers and build one expanded document for validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
document
|
Mapping[str, Any]
|
Decoded JSON bundle document to inspect. |
required |
Returns:
| Type | Description |
|---|---|
Mapping[str, Any]
|
Document with resolvable local pointers expanded. |
Raises:
| Type | Description |
|---|---|
BundleReferenceError
|
If one or more local pointers cannot resolve. |