Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion openapidocs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.2.0"
__version__ = "1.2.1"
VERSION = __version__
26 changes: 13 additions & 13 deletions openapidocs/utils/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down