Skip to content

Commit

Permalink
plugin - docs
Browse files Browse the repository at this point in the history
  • Loading branch information
commonism committed Aug 9, 2023
1 parent ea99efb commit 944a08e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions aiopenapi3/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ class Init(Plugin):
@dataclasses.dataclass
class Context:
initialized: "OpenAPI" = None
"""available in :func:`~aiopenapi3.plugin.Init.initialized`"""
schemas: Dict[str, "Schema"] = None
"""available in :func:`~aiopenapi3.plugin.Init.schemas`"""
paths: Dict[str, "PathItemBase"] = None
"""available in :func:`~aiopenapi3.plugin.Init.paths`"""

def schemas(self, ctx: "Init.Context") -> "Init.Context": # pragma: no cover
pass
Expand All @@ -48,7 +51,9 @@ class Document(Plugin):
@dataclasses.dataclass
class Context:
url: yarl.URL
"""available in :func:`~aiopenapi3.plugin.Document.loaded` :func:`~aiopenapi3.plugin.Document.parsed`"""
document: Dict[str, Any]
"""available in :func:`~aiopenapi3.plugin.Document.loaded` :func:`~aiopenapi3.plugin.Document.parsed`"""

"""
loaded(text) -> parsed(dict)
Expand Down
1 change: 1 addition & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Init plugins are used to signal the setup is done.
:members:

.. autoclass:: Init
:members: schemas, paths, initialized

Document Plugins
----------------
Expand Down
9 changes: 7 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ def linkcode_resolve(domain, info):

mod = importlib.import_module(info["module"])
if "." in info["fullname"]:
objname, attrname = info["fullname"].split(".")
obj = getattr(mod, objname)
*objname, attrname = info["fullname"].split(".")
obj = mod
try:
for i in objname:
obj = getattr(obj, i)
except AttributeError:
return None
try:
# object is a method of a class
obj = getattr(obj, attrname)
Expand Down

0 comments on commit 944a08e

Please sign in to comment.