diff --git a/openapi_first/__init__.pyi b/openapi_first/__init__.pyi index 03c74ef..b86111d 100644 --- a/openapi_first/__init__.pyi +++ b/openapi_first/__init__.pyi @@ -5,5 +5,15 @@ from . import codegen as codegen from . import codegen_routes as codegen_routes from . import errors as errors from . import loader as loader +from . import security as security -__all__ = ["app", "binder", "loader", "client", "errors", "codegen", "codegen_routes"] +__all__ = [ + "app", + "binder", + "loader", + "client", + "errors", + "codegen", + "codegen_routes", + "security", +] diff --git a/openapi_first/cli.pyi b/openapi_first/cli.pyi new file mode 100644 index 0000000..4379617 --- /dev/null +++ b/openapi_first/cli.pyi @@ -0,0 +1,7 @@ +from pathlib import Path + +DEFAULT_TEMPLATE: str + +def available_templates() -> list[str]: ... +def copy_template(template: str, target_dir: Path) -> None: ... +def main() -> None: ... diff --git a/openapi_first/codegen.pyi b/openapi_first/codegen.pyi new file mode 100644 index 0000000..c2e0371 --- /dev/null +++ b/openapi_first/codegen.pyi @@ -0,0 +1,11 @@ +from pathlib import Path + +from .codegen_routes import generate_routes + +def generate_models( + spec_path: Path, + output_path: Path, + pydantic_version: int = ..., +) -> None: ... + +__all__ = ["generate_models", "generate_routes"] diff --git a/openapi_first/codegen_routes.pyi b/openapi_first/codegen_routes.pyi new file mode 100644 index 0000000..dce30f8 --- /dev/null +++ b/openapi_first/codegen_routes.pyi @@ -0,0 +1,9 @@ +from pathlib import Path + +def generate_routes( + spec_path: Path, + output_dir: Path, + *, + use_models: bool = ..., + models_module: str = ..., +) -> list[Path]: ... diff --git a/openapi_first/security.pyi b/openapi_first/security.pyi new file mode 100644 index 0000000..d4ca76e --- /dev/null +++ b/openapi_first/security.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def parse_security_schemes(spec: dict[str, Any]) -> dict[str, dict[str, Any]]: ... +def make_security_dependencies( + spec: dict[str, Any], + security_schemes: dict[str, dict[str, Any]], +) -> dict[str, list[Any]]: ... diff --git a/pyproject.toml b/pyproject.toml index e4ce75b..3416309 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,7 +102,7 @@ Versions = "https://git.aetoskia.com/aetos/openapi-first/tags" packages = { find = { include = ["openapi_first*"] } } [tool.setuptools.package-data] -openapi_first = ["py.typed", "templates/**/*"] +openapi_first = ["py.typed", "templates/**/*", '\.pyi?$'] [tool.pytest.ini_options]