From 10a32750b843c2ecf9b3766915a196ee5c5fdf6f Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Wed, 30 Jul 2025 19:35:44 +0200 Subject: [PATCH 1/3] Prepare for 1.1.3 --- CHANGELOG.md | 9 +++++++++ neoteroi/mkdocs/__init__.py | 2 +- neoteroi/mkdocs/oad/__init__.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abaf09e..1a73e0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ 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.1.3] 2025-07-30 + +- Improve `read_from_source()` to support an optional CWD parameter used to + look for the OpenAPI spec. The OpenAPI plugin should supply that CWD relative + to the current markdown file being processed. Markdown customarily uses + paths relative to the document itself. Existing relative paths will not break, + since this will attempt paths relative to both working directories, by + @joewlambeth. + ## [1.1.2] 2025-04-22 - Correct the contribs plugin to use the `--follow` option when obtaining diff --git a/neoteroi/mkdocs/__init__.py b/neoteroi/mkdocs/__init__.py index 72f26f5..0b2f79d 100644 --- a/neoteroi/mkdocs/__init__.py +++ b/neoteroi/mkdocs/__init__.py @@ -1 +1 @@ -__version__ = "1.1.2" +__version__ = "1.1.3" diff --git a/neoteroi/mkdocs/oad/__init__.py b/neoteroi/mkdocs/oad/__init__.py index 94bff53..e0e83eb 100644 --- a/neoteroi/mkdocs/oad/__init__.py +++ b/neoteroi/mkdocs/oad/__init__.py @@ -9,8 +9,8 @@ neoteroi.mkdocs.oad """ -from pathlib import Path import re +from pathlib import Path from mkdocs.config.config_options import Type from mkdocs.plugins import BasePlugin From 26eac38c29904a802366b91ba1c8dea4e5c39537 Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Wed, 30 Jul 2025 19:36:52 +0200 Subject: [PATCH 2/3] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9b14d63..6322ffe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ keywords = [ "documentation", ] dependencies = [ - "essentials-openapi", + "essentials-openapi>=1.2.1", "mkdocs", "httpx", "click", From 5a5f766f6ac46bbb519d02e6d2cdd951a641412c Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Wed, 30 Jul 2025 20:13:43 +0200 Subject: [PATCH 3/3] Fix tests --- requirements.txt | 2 +- tests/test_mkdocsoad.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 569dfbc..d02af6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ pytest pytest-cov -essentials-openapi[full]>=1.0.2 +essentials-openapi[full]>=1.2.1 mkdocs flake8 black diff --git a/tests/test_mkdocsoad.py b/tests/test_mkdocsoad.py index 9332177..a6cb80c 100644 --- a/tests/test_mkdocsoad.py +++ b/tests/test_mkdocsoad.py @@ -1,4 +1,5 @@ import textwrap +from unittest.mock import Mock import pytest @@ -7,6 +8,15 @@ from . import get_resource_file_path +def make_mock_page(src_dir="docs", src_path="index.md"): + mock_file = Mock() + mock_file.src_dir = src_dir + mock_file.src_path = src_path + mock_page = Mock() + mock_page.file = mock_file + return mock_page + + def test_markdown_without_oad(): handler = MkDocsOpenAPIDocumentationPlugin() @@ -20,7 +30,7 @@ def test_markdown_without_oad(): ) ) - result = handler.on_page_markdown(example) + result = handler.on_page_markdown(example, make_mock_page()) assert result == example @@ -39,7 +49,7 @@ def test_markdown_with_oad(file_name): ) ) - result = handler.on_page_markdown(example) + result = handler.on_page_markdown(example, make_mock_page()) # Note: not testing the full output since this responsibility belongs to the # essentials-openapi package