diff --git a/python_json_config/config_node.py b/python_json_config/config_node.py
index 0b23352..972900a 100644
--- a/python_json_config/config_node.py
+++ b/python_json_config/config_node.py
@@ -15,10 +15,17 @@ class ConfigNode(object):
 
         self.__node_dict = node_dict
 
-    def __getattr__(self, item):
+    def __getattr__(self, item: str):
         return self.get(item)
 
     def get(self, path: Union[str, List[str]]):
+        """
+        Retrieve a value in the config. If the referenced field does not exist an KeyError is thrown.
+        :param path: The key of the field. Can be either a string with '.' as delimiter of the nesting levels or a list
+                     of keys with each element being one nesting level.
+                     E.g., the string 'key1.key2' and list ['key1', 'key2'] reference the same config element.
+        :return: The value of the referenced field.
+        """
         path = normalize_path(path)
         key = path[0]
         try:
@@ -29,9 +36,17 @@ class ConfigNode(object):
                 return value.get(path[1:])
         except KeyError as exception:
             print_path = '.'.join(self.__path) + ('.' if len(self.__path) > 0 else '')
-            raise KeyError(f'No value exists for key "{print_path}{key}"') from exception
+            raise AttributeError(f'No value exists for key "{print_path}{key}"') from exception
 
-    def update(self, path: Union[str, List[str]], value):
+    def update(self, path: Union[str, List[str]], value) -> None:
+        """
+        Update field in the config.
+        :param path: The name of the field. Can be either a string with '.' as delimiter of the nesting levels or a list
+                     of keys with each element being one nesting level.
+                     E.g., the string 'key1.key2' and list ['key1', 'key2'] reference the same config element.
+        :param value: The value that should replace the old value. If this value is a dictionary it is transformed into
+                      a ConfigNode.
+        """
         path = normalize_path(path)
         key = path[0]
         if len(path) == 1:
@@ -42,6 +57,21 @@ class ConfigNode(object):
         else:
             self.get(key).update(path[1:], value)
 
+    def __contains__(self, item: Union[str, List[str]]) -> bool:
+        """
+        Test if a field exists in the config and is not None (result in the case of a non-existing optional field).
+        If the field does not exist, an AttributeError is thrown, and therefore False is returned.
+        :param item: The field whose existence is tested. Can be either a string with '.' as delimiter of the nesting
+                     levels or a list of keys with each element being one nesting level.
+                     E.g., the string 'key1.key2' and list ['key1', 'key2'] reference the same config element.
+        :return: True if the field exists in the Config and False otherwise.
+        """
+        try:
+            result = self.get(item)
+            return result is not None
+        except AttributeError:
+            return False
+
     def __str__(self):
         return f'ConfigNode(path={self.__path}, values={self.__node_dict})'
 

Check if key exists in config
It would be good to have the possibility to check if a certain configuration parameter is defined within the configuration or not. So basically something like this should be possible:

```python
if 'backend.media.type' in config:
    return True
else:
    return False
```
diff --git a/tests/config_node_test.py b/tests/config_node_test.py
index 86521fc..0dc62b6 100644
--- a/tests/config_node_test.py
+++ b/tests/config_node_test.py
@@ -33,10 +33,10 @@ class ConfigNodeTest(TestCase):
     def test_get(self):
         node = ConfigNode(self.config_dict)
         self.assertEqual(node.key1, 1)
-        with self.assertRaises(KeyError): node.nokey
+        with self.assertRaises(AttributeError): node.nokey
 
         self.assertEqual(node.get('key1'), 1)
-        with self.assertRaises(KeyError): node.get('nokey')
+        with self.assertRaises(AttributeError): node.get('nokey')
 
         self.assertEqual(node.get('key2.key3'), 3)
 
@@ -50,7 +50,7 @@ class ConfigNodeTest(TestCase):
         self.assertIsInstance(node.key1, ConfigNode)
         self.assertEqual(node.key1.newkey, 1)
 
-        with self.assertRaises(KeyError): node.key3
+        with self.assertRaises(AttributeError): node.key3
         node.update('key3', 'asd')
         self.assertEqual(node.key3, 'asd')
 
@@ -69,3 +69,11 @@ class ConfigNodeTest(TestCase):
         self.assertEqual(pickle_conf.key1, 1)
         self.assertEqual(pickle_conf.key2.key3, 3)
         self.assertEqual(pickle_conf.key2.key4.key5, 5)
+
+    def test_contains(self):
+        config = ConfigNode(self.config_dict)
+        self.assertTrue('key1' in config)
+        self.assertFalse('key1.key2' in config)
+        self.assertTrue('key2.key3' in config)
+        self.assertTrue('key2.key4.key5' in config)
+        self.assertFalse('key2.key4.key6' in config)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
-e git+https://github.com/janehmueller/python-json-config.git@b1b657ffcbd1565b7a6e859b9383cc8c6dfdd892#egg=python_json_config
tomli==2.2.1

name: python-json-config
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - tomli==2.2.1
prefix: /opt/conda/envs/python-json-config

tests/config_node_test.py::ConfigNodeTest::test_contains tests/config_node_test.py::ConfigNodeTest::test_get tests/config_node_test.py::ConfigNodeTest::test_update
tests/config_node_test.py::ConfigNodeTest::test_creation tests/config_node_test.py::ConfigNodeTest::test_pickle tests/config_node_test.py::ConfigNodeTest::test_string
python_json_config/config_node.py
python_json_config/config_node.py