diff --git a/CHANGELOG.md b/CHANGELOG.md index 24681a5..c975edd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.1] - 2025-07-30 + +- Added support for using the current working directory (CWD) as an option when + handling OpenAPI links, by @joewlambeth. + ## [1.2.0] - 2025-04-27 - Update objects to the OpenAPI Specification v3.1, by @tyzhnenko. diff --git a/openapidocs/__init__.py b/openapidocs/__init__.py index 1091dc1..3568f76 100644 --- a/openapidocs/__init__.py +++ b/openapidocs/__init__.py @@ -1,2 +1,2 @@ -__version__ = "1.2.0" +__version__ = "1.2.1" VERSION = __version__ diff --git a/openapidocs/utils/source.py b/openapidocs/utils/source.py index 5192d1c..8fa9d96 100644 --- a/openapidocs/utils/source.py +++ b/openapidocs/utils/source.py @@ -76,23 +76,23 @@ def read_from_source(source: str, cwd: Path = None): potential_paths.append(cwd / source) for source_path in potential_paths: - if source_path.exists(): - if not source_path.is_file(): - raise ValueError("The given path is not a file path.") + if source_path.exists(): + if not source_path.is_file(): + raise ValueError("The given path is not a file path.") - logger.debug("Reading from file %s", source) + logger.debug("Reading from file %s", source) - file_path = source.lower() + file_path = source.lower() - if file_path.endswith(".json"): - return read_from_json_file(source_path) + if file_path.endswith(".json"): + return read_from_json_file(source_path) - if file_path.endswith(".yaml") or file_path.endswith(".yml"): - return read_from_yaml_file(source_path) - else: - raise ValueError("Unsupported source file.") - else: - logger.debug("Path %s does not exist, trying next.", source) + if file_path.endswith(".yaml") or file_path.endswith(".yml"): + return read_from_yaml_file(source_path) + else: + raise ValueError("Unsupported source file.") + else: + logger.debug("Path %s does not exist, trying next.", source) source_lower = source.lower()