diff --git a/dnry/config/yaml/source.py b/dnry/config/yaml/source.py
index 8742b25..23d9e8d 100644
--- a/dnry/config/yaml/source.py
+++ b/dnry/config/yaml/source.py
@@ -17,6 +17,9 @@ class YamlSource(IConfigSource):
             paths = ",".join(self.__paths)
             raise RuntimeError(f"Configuration Error: None of these paths could be found: {paths}")
 
+        elif path is None and not self.__required:
+            return dict()
+
         with open(path, 'r') as f:
             return yaml.load(f, Loader=self.__loader) or dict()
 

Optional flag for yaml files is not obeyed
When trying to add an optional YamlSource where the given yaml file does not exist, the following error is raised:

```expected str, bytes or os.PathLike object, not NoneType```

It appears the YamlSource load method is checking if the source is required or not to raise a runtime error. It correctly skips raising the error but still tries to read the file using open().  This results in the TypeError.

Line 14 of `dnry/config/yaml/source.py`
```python
    def load(self, fact: IConfigFactory, conf: IConfigSection) -> dict:
        path = self.__get_first_existing_path()
        if path is None and self.__required:
            paths = ",".join(self.__paths)
            raise RuntimeError(f"Configuration Error: None of these paths could be found: {paths}")

        with open(path, 'r') as f:
            return yaml.load(f, Loader=self.__loader```
diff --git a/test/test_bugs.py b/test/test_bugs.py
index e34fa06..e83dc27 100644
--- a/test/test_bugs.py
+++ b/test/test_bugs.py
@@ -9,7 +9,7 @@ from dnry.config.yaml import YamlSource
 class TestBugs(unittest.TestCase):
 
     def test_empty_yaml_file(self):
-        temp_file = f"./${uuid4()}.yaml"
+        temp_file = f"./{uuid4()}.yaml"
         with open(temp_file, 'w') as fd:
             fd.write('\n')
         try:
@@ -21,3 +21,10 @@ class TestBugs(unittest.TestCase):
 
         finally:
             os.remove(temp_file)
+
+    def test_optional_flag(self):
+        fact = ConfigFactory()
+        fact.add_source(YamlSource(f"./{uuid4()}", required=False))
+        conf = fact.build()
+        none_val = conf.get("no:key")
+        self.assertIsNone(none_val)

pip install -e .
parse_log_pytest
requirements.txt
pytest
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
-e git+https://github.com/en0/dnry-config.git@296dfdc2eee8f82f0926d102f42db2f5fd8f2efb#egg=dnry_config
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
PyYAML==6.0.2
tomli==2.2.1

name: dnry-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
      - pyyaml==6.0.2
      - tomli==2.2.1
prefix: /opt/conda/envs/dnry-config

test/test_bugs.py::TestBugs::test_optional_flag
test/test_bugs.py::TestBugs::test_empty_yaml_file
dnry/config/yaml/source.py
dnry/config/yaml/source.py