Skip to content

Commit 088ceda

Browse files
committed
Reference docs
1 parent b8f0644 commit 088ceda

File tree

6 files changed

+64
-3
lines changed

6 files changed

+64
-3
lines changed

docs/reference/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Reference
2+
3+
Documentation with information of functions, classes or methods and all other parts of the OpenAPI-core public API.

docs/reference/openapi.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# `OpenAPI` class
2+
3+
::: openapi_core.OpenAPI
4+
options:
5+
members:
6+
- from_dict
7+
- from_path
8+
- from_file_path
9+
- from_file

mkdocs.yml

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ theme:
4646
- toc.follow
4747
repo_name: python-openapi/openapi-core
4848
repo_url: https://github.com/python-openapi/openapi-core
49+
plugins:
50+
- mkdocstrings:
51+
handlers:
52+
python:
53+
options:
54+
extensions:
55+
- griffe_typingdoc
4956
nav:
5057
- OpenAPI-core: index.md
5158
- unmarshalling.md
@@ -75,6 +82,9 @@ nav:
7582
- customizations/extra_format_unmarshallers.md
7683
- security.md
7784
- extensions.md
85+
- Reference:
86+
- reference/index.md
87+
- reference/openapi.md
7888
- contributing.md
7989
markdown_extensions:
8090
- admonition

openapi_core/app.py

+25-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from openapi_spec_validator.versions.datatypes import SpecVersion
1515
from openapi_spec_validator.versions.exceptions import OpenAPIVersionNotFound
1616
from openapi_spec_validator.versions.shortcuts import get_spec_version
17+
from typing_extensions import Annotated
18+
from typing_extensions import Doc
1719

1820
from openapi_core.configurations import Config
1921
from openapi_core.exceptions import SpecError
@@ -72,11 +74,28 @@
7274

7375

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

7789
def __init__(
7890
self,
79-
spec: SchemaPath,
91+
spec: Annotated[
92+
SchemaPath,
93+
Doc(
94+
"""
95+
OpenAPI specification schema path object.
96+
"""
97+
),
98+
],
8099
config: Optional[Config] = None,
81100
):
82101
if not isinstance(spec, SchemaPath):
@@ -91,20 +110,23 @@ def __init__(
91110
def from_dict(
92111
cls, data: Schema, config: Optional[Config] = None, base_uri: str = ""
93112
) -> "OpenAPI":
113+
"""Creates :class:`OpenAPI` class instance from a dictionary."""
94114
sp = SchemaPath.from_dict(data, base_uri=base_uri)
95115
return cls(sp, config=config)
96116

97117
@classmethod
98118
def from_path(
99119
cls, path: Path, config: Optional[Config] = None
100120
) -> "OpenAPI":
121+
"""Creates :class:`OpenAPI` class instance from a path object."""
101122
sp = SchemaPath.from_path(path)
102123
return cls(sp, config=config)
103124

104125
@classmethod
105126
def from_file_path(
106127
cls, file_path: str, config: Optional[Config] = None
107128
) -> "OpenAPI":
129+
"""Creates :class:`OpenAPI` class instance from a file path string."""
108130
sp = SchemaPath.from_file_path(file_path)
109131
return cls(sp, config=config)
110132

@@ -115,6 +137,7 @@ def from_file(
115137
config: Optional[Config] = None,
116138
base_uri: str = "",
117139
) -> "OpenAPI":
140+
"""Creates :class:`OpenAPI` class instance from a file object."""
118141
sp = SchemaPath.from_file(fileobj, base_uri=base_uri)
119142
return cls(sp, config=config)
120143

poetry.lock

+16-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ fastapi = ">=0.111,<0.115"
117117
mkdocs = "^1.6.1"
118118
mkdocstrings = {extras = ["python"], version = "^0.26.1"}
119119
mkdocs-material = "^9.5.34"
120+
griffe-typingdoc = "^0.2.7"
120121

121122
[tool.pytest.ini_options]
122123
addopts = """

0 commit comments

Comments
 (0)