Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference code API docs #781

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
API Reference
=============

Documentation with information of functions, classes or methods and all other parts of the OpenAPI-core public API.

.. toctree::
:maxdepth: 1

openapi
5 changes: 5 additions & 0 deletions docs/api/openapi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`OpenAPI` class
===============

.. autoclass:: openapi_core.OpenAPI
:members:
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
"sphinx_immaterial",
]

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ openapi-core
customizations/index
security
extensions
api/index
contributing

Openapi-core is a Python library that adds client-side and server-side support
Expand Down
16 changes: 15 additions & 1 deletion openapi_core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@


class OpenAPI:
"""OpenAPI class."""
"""`OpenAPI` application class, the main entrypoint class for OpenAPI-core.

Read more information, in the
[OpenAPI-core docs for First Steps](https://openapi-core.readthedocs.io/#first-steps).

Import :class:`OpenAPI` class from the main `openapi_core` module::

from openapi_core import OpenAPI

app = OpenAPI(spec)
"""

def __init__(
self,
Expand All @@ -90,27 +100,31 @@ def __init__(
def from_dict(
cls, data: Schema, config: Optional[Config] = None
) -> "OpenAPI":
"""Creates :class:`OpenAPI` class instance from a dictionary."""
sp = SchemaPath.from_dict(data)
return cls(sp, config=config)

@classmethod
def from_path(
cls, path: Path, config: Optional[Config] = None
) -> "OpenAPI":
"""Creates :class:`OpenAPI` class instance from a path object."""
sp = SchemaPath.from_path(path)
return cls(sp, config=config)

@classmethod
def from_file_path(
cls, file_path: str, config: Optional[Config] = None
) -> "OpenAPI":
"""Creates :class:`OpenAPI` class instance from a file path string."""
sp = SchemaPath.from_file_path(file_path)
return cls(sp, config=config)

@classmethod
def from_file(
cls, fileobj: SupportsRead, config: Optional[Config] = None
) -> "OpenAPI":
"""Creates :class:`OpenAPI` class instance from a file object."""
sp = SchemaPath.from_file(fileobj)
return cls(sp, config=config)

Expand Down
23 changes: 21 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pyflakes = "^3.1.0"
[tool.poetry.group.docs.dependencies]
sphinx = ">=5.3,<8.0"
sphinx-immaterial = "^0.11.0"
sphinx-autodoc-typehints = "^2.0.0"

[tool.pytest.ini_options]
addopts = """
Expand Down
Loading