Skip to content

Commit 5cb0824

Browse files
committed
Reference code API docs
1 parent 9762b79 commit 5cb0824

File tree

7 files changed

+53
-3
lines changed

7 files changed

+53
-3
lines changed

docs/api/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
API Reference
2+
=============
3+
4+
Documentation with information of functions, classes or methods and all other parts of the OpenAPI-core public API.
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
9+
openapi

docs/api/openapi.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
`OpenAPI` class
2+
===============
3+
4+
.. autoclass:: openapi_core.OpenAPI
5+
:members:

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"sphinx.ext.intersphinx",
3939
"sphinx.ext.coverage",
4040
"sphinx.ext.viewcode",
41+
"sphinx_autodoc_typehints",
4142
"sphinx_immaterial",
4243
]
4344

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ openapi-core
1111
customizations/index
1212
security
1313
extensions
14+
api/index
1415
contributing
1516

1617
Openapi-core is a Python library that adds client-side and server-side support

openapi_core/app.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,17 @@
7171

7272

7373
class OpenAPI:
74-
"""OpenAPI class."""
74+
"""`OpenAPI` application class, the main entrypoint class for OpenAPI-core.
75+
76+
Read more information, in the
77+
[OpenAPI-core docs for First Steps](https://openapi-core.readthedocs.io/#first-steps).
78+
79+
Import :class:`OpenAPI` class from the main `openapi_core` module::
80+
81+
from openapi_core import OpenAPI
82+
83+
app = OpenAPI(spec)
84+
"""
7585

7686
def __init__(
7787
self,
@@ -90,27 +100,31 @@ def __init__(
90100
def from_dict(
91101
cls, data: Schema, config: Optional[Config] = None
92102
) -> "OpenAPI":
103+
"""Creates :class:`OpenAPI` class instance from a dictionary."""
93104
sp = SchemaPath.from_dict(data)
94105
return cls(sp, config=config)
95106

96107
@classmethod
97108
def from_path(
98109
cls, path: Path, config: Optional[Config] = None
99110
) -> "OpenAPI":
111+
"""Creates :class:`OpenAPI` class instance from a path object."""
100112
sp = SchemaPath.from_path(path)
101113
return cls(sp, config=config)
102114

103115
@classmethod
104116
def from_file_path(
105117
cls, file_path: str, config: Optional[Config] = None
106118
) -> "OpenAPI":
119+
"""Creates :class:`OpenAPI` class instance from a file path string."""
107120
sp = SchemaPath.from_file_path(file_path)
108121
return cls(sp, config=config)
109122

110123
@classmethod
111124
def from_file(
112125
cls, fileobj: SupportsRead, config: Optional[Config] = None
113126
) -> "OpenAPI":
127+
"""Creates :class:`OpenAPI` class instance from a file object."""
114128
sp = SchemaPath.from_file(fileobj)
115129
return cls(sp, config=config)
116130

poetry.lock

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

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pyflakes = "^3.1.0"
112112
[tool.poetry.group.docs.dependencies]
113113
sphinx = ">=5.3,<8.0"
114114
sphinx-immaterial = "^0.11.0"
115+
sphinx-autodoc-typehints = "^2.0.0"
115116

116117
[tool.pytest.ini_options]
117118
addopts = """

0 commit comments

Comments
 (0)