Skip to content

Commit ba20273

Browse files
🔥 Remove support for plugins.
1 parent 8c35460 commit ba20273

File tree

19 files changed

+2212
-896
lines changed

19 files changed

+2212
-896
lines changed

‎.config/mkdocs.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ docs_dir: ../docs
55

66
nav:
77
- index.md
8-
- plugins.md
98
- openapi.md
109
- json-schema.md

‎ChangeLog.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
[Unreleased]
1010

11-
### Added
11+
### Removed
1212

13-
- Support for OpenAPI plugins.
14-
- Support for extra sources.
13+
- Support for JSONPatch
1514

1615
### Changed
1716

18-
- JSON Patch support is now a plugin.
1917
- Breaking: openapi directory is now `${source root}/openapi`
2018

2119

‎docs/index.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,4 @@ origin
6767
extra_sources
6868
: list of additional source roots for manually written python files.
6969

70-
plugins
71-
: list of plugin classes. See [the section on plug-ins](/plugins)
72-
7370
At least one of `document_path` and `origin` is required. Saving OpenAPI document in the project is recommended for repeatable builds.

‎docs/plugins.md‎

Lines changed: 0 additions & 184 deletions
This file was deleted.

‎poetry.lock‎

Lines changed: 7 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ python = "^3.12"
3434
asyncclick = "^8.1.7.2"
3535
frozendict = "^2.4.6"
3636
httpx = "^0.27.0"
37-
jsonpatch = "^1.32"
3837
libcst = "^1.5.1"
3938
openapi-pydantic = ">=0.5.0,<0.6.0"
4039
pybase62 = "^1.0.0"

‎src/lapidary/render/config.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
class Config(pydantic.BaseModel):
1111
document_path: str | None = None
12+
"""URL or path relative to ./openapi/"""
1213
extra_sources: Sequence[str] = ()
1314
origin: pydantic.AnyHttpUrl | None = None
15+
"""Origin URL in case"""
1416
package: str
15-
plugins: Sequence[str] = ()
1617

1718

1819
async def load_config(project_root: anyio.Path) -> Config:

‎src/lapidary/render/load.py‎

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,22 @@
11
import abc
2-
import importlib.machinery
3-
import importlib.util
42
import logging
5-
from collections.abc import Mapping, MutableSequence, Sequence
6-
from typing import cast
3+
from collections.abc import Mapping
74

85
import anyio
96
import httpx
107
import ruamel.yaml
118

129
from .config import Config
13-
from .plugins import ProcessorPlugin, sys_path_manager
1410

1511
logger = logging.getLogger(__name__)
1612

1713

1814
async def load_document(root: anyio.Path, config: Config) -> Mapping:
1915
logger.info('Load OpenAPI document')
20-
spec_dict: dict = cast(dict, await load_parse(root, config.document_path))
2116

22-
if config.plugins:
23-
spec_dict = await apply_processor_plugins(spec_dict, config, root)
24-
25-
return spec_dict
26-
27-
28-
async def apply_processor_plugins(descr_dict: dict, config: Config, project_root: anyio.Path) -> dict:
29-
processor_classes: MutableSequence[type[ProcessorPlugin]] = []
30-
with sys_path_manager(str(project_root / 'plugins')):
31-
for plugin_path in config.plugins:
32-
module_name, class_name = plugin_path.split(':')
33-
processor_classes.append(getattr(importlib.import_module(module_name), class_name))
34-
35-
for factory in processor_classes:
36-
processor = factory()
37-
descr_dict = await processor.process_mapping(descr_dict, config, project_root)
38-
39-
return descr_dict
40-
41-
42-
async def load_parse(root: anyio.Path, path: str | anyio.Path) -> Mapping | Sequence:
43-
text = await document_handler_for(root, path).load()
44-
return parse(text)
45-
46-
47-
def parse(text: str) -> Mapping:
4817
yaml = ruamel.yaml.YAML(typ='safe')
18+
19+
text = await document_handler_for(root, config.document_path).load()
4920
return yaml.load(text)
5021

5122

0 commit comments

Comments
 (0)