{"id":5979,"library":"json-ref-dict","title":"JSON Ref Dict","description":"json-ref-dict is a Python dict-like object that abstracts the resolution of JSONSchema references. It allows lazy loading of referenced documents, supporting both local filesystem and remote HTTP/HTTPS references. The library is currently at version 0.7.2 and maintains an active release cadence with frequent updates.","status":"active","version":"0.7.2","language":"en","source_language":"en","source_url":"https://github.com/jacksmith15/json-ref-dict","tags":["json","schema","reference","lazy-loading","dict","jsonschema"],"install":[{"cmd":"pip install json-ref-dict","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Optional dependency to enable loading of YAML documents; without it, only JSON documents are supported.","package":"PyYAML","optional":true}],"imports":[{"symbol":"RefDict","correct":"from json_ref_dict import RefDict"},{"note":"The `JsonRefDict` alias for `RefDict` was removed in version 0.6.0. Use `RefDict` directly.","wrong":"from json_ref_dict import JsonRefDict","symbol":"JsonRefDict","correct":"from json_ref_dict import RefDict"}],"quickstart":{"code":"import os\nfrom json_ref_dict import RefDict\n\n# Create dummy YAML files for the example\nmaster_yaml_content = \"\"\"\ndefinitions:\n  foo:\n    type: string\n  local_ref:\n    $ref: '#/definitions/foo'\n  remote_ref:\n    $ref: 'other.yaml#/definitions/bar'\n  backref:\n    $ref: 'other.yaml#/definitions/baz'\n\"\"\"\n\nother_yaml_content = \"\"\"\ndefinitions:\n  bar:\n    type: integer\n  baz:\n    $ref: 'master.yaml#/definitions/foo'\n\"\"\"\n\nwith open(\"master.yaml\", \"w\") as f:\n    f.write(master_yaml_content)\nwith open(\"other.yaml\", \"w\") as f:\n    f.write(other_yaml_content)\n\ntry:\n    # Initialize RefDict with a reference to a local YAML file and JSON pointer\n    schema = RefDict(\"master.yaml#/definitions\")\n\n    # Accessing elements triggers lazy resolution\n    print(\"Type of local_ref:\", schema[\"local_ref\"][\"type\"])\n    print(\"Type of remote_ref:\", schema[\"remote_ref\"][\"type\"])\n    print(\"Type of backref:\", schema[\"backref\"][\"type\"])\n\n    # Materialize the document to a regular dict (optional)\n    # from json_ref_dict import materialize\n    # materialized_schema = materialize(schema)\n    # print(\"Materialized schema type:\", type(materialized_schema))\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    # Clean up dummy files\n    os.remove(\"master.yaml\")\n    os.remove(\"other.yaml\")","lang":"python","description":"This quickstart demonstrates how to create a `RefDict` instance from a local YAML file containing JSON references, including local, remote, and back references. It shows how lazy loading works by accessing properties and includes cleanup of the temporary files created for the example."},"warnings":[{"fix":"Update any direct access to `obj.__json_ref__` to `obj.__reference__`.","message":"The internal attribute for accessing the original JSON reference object was renamed from `__json_ref__` to `__reference__` to align with the `jsonref` library conventions.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"If you relied on `RefDict` being a mutable `dict`, reassess your logic. For type checks, use `isinstance(obj, collections.abc.Mapping)` instead of `isinstance(obj, dict)`.","message":"`RefDict` no longer inherits directly from `dict`, but now from `collections.abc.Mapping`. This changes its behavior regarding mutability and can affect `isinstance` checks. `RefDict` instances are now immutable collections.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Always use `RefDict` directly for imports and class instantiation.","message":"The `JsonRefDict` alias for `RefDict` has been removed.","severity":"deprecated","affected_versions":">=0.6.0"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}