From de32f62ae231b02b6a0e51d73049f308d26e373d Mon Sep 17 00:00:00 2001 From: Sindre Hansen Date: Wed, 19 Nov 2025 11:28:15 +0100 Subject: [PATCH 1/3] Bump essentials-openapi requirement to 1.3.0 Necessary to have support for templates. --- pyproject.toml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6322ffe..18acfaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ keywords = [ "documentation", ] dependencies = [ - "essentials-openapi>=1.2.1", + "essentials-openapi>=1.3.0", "mkdocs", "httpx", "click", diff --git a/requirements.txt b/requirements.txt index d02af6c..7ef6d0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ pytest pytest-cov -essentials-openapi[full]>=1.2.1 +essentials-openapi[full]>=1.3.0 mkdocs flake8 black From 397790be9853e7aea7272eab6b87086419557be4 Mon Sep 17 00:00:00 2001 From: Sindre Hansen Date: Wed, 19 Nov 2025 11:29:14 +0100 Subject: [PATCH 2/3] Extend config scheme with templates_path --- neoteroi/mkdocs/oad/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/neoteroi/mkdocs/oad/__init__.py b/neoteroi/mkdocs/oad/__init__.py index e0e83eb..7544fee 100644 --- a/neoteroi/mkdocs/oad/__init__.py +++ b/neoteroi/mkdocs/oad/__init__.py @@ -11,6 +11,7 @@ import re from pathlib import Path +from typing import Optional from mkdocs.config.config_options import Type from mkdocs.plugins import BasePlugin @@ -19,13 +20,19 @@ class MkDocsOpenAPIDocumentationPlugin(BasePlugin): - config_scheme = (("use_pymdownx", Type(bool, default=False)),) + config_scheme = ( + ("use_pymdownx", Type(bool, default=False)), + ("templates_path", Type(str, default=None)), + ) rx = re.compile(r"\[OAD\(([^\)]+)\)\]") def _get_style(self) -> str: return "MKDOCS" if self.config.get("use_pymdownx", False) else "MARKDOWN" + def _get_templates_path(self) -> Optional[str]: + return self.config.get("templates_path", None) + def _replacer(self, cwd): def replace(match) -> str: source = match.group(1).strip("'\"") @@ -33,7 +40,10 @@ def replace(match) -> str: data = read_from_source(source, cwd) handler = OpenAPIV3DocumentationHandler( - data, style=self._get_style(), source=source + data, + style=self._get_style(), + source=source, + templates_path=self._get_templates_path(), ) return handler.write() From 2af891290a83610d179205471fc6316fe49b3845 Mon Sep 17 00:00:00 2001 From: Sindre Hansen Date: Wed, 19 Nov 2025 11:35:01 +0100 Subject: [PATCH 3/3] Bump version 1.2.0 --- neoteroi/mkdocs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neoteroi/mkdocs/__init__.py b/neoteroi/mkdocs/__init__.py index 0b2f79d..c68196d 100644 --- a/neoteroi/mkdocs/__init__.py +++ b/neoteroi/mkdocs/__init__.py @@ -1 +1 @@ -__version__ = "1.1.3" +__version__ = "1.2.0"