feat: add type stubs for cli, codegen, and security modules

This commit is contained in:
2026-09-12 15:29:04 +05:30
parent 6e3939d68c
commit cb231a9c7e
6 changed files with 46 additions and 2 deletions

View File

@@ -5,5 +5,15 @@ from . import codegen as codegen
from . import codegen_routes as codegen_routes from . import codegen_routes as codegen_routes
from . import errors as errors from . import errors as errors
from . import loader as loader 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",
]

7
openapi_first/cli.pyi Normal file
View File

@@ -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: ...

11
openapi_first/codegen.pyi Normal file
View File

@@ -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"]

View File

@@ -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]: ...

View File

@@ -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]]: ...

View File

@@ -102,7 +102,7 @@ Versions = "https://git.aetoskia.com/aetos/openapi-first/tags"
packages = { find = { include = ["openapi_first*"] } } packages = { find = { include = ["openapi_first*"] } }
[tool.setuptools.package-data] [tool.setuptools.package-data]
openapi_first = ["py.typed", "templates/**/*"] openapi_first = ["py.typed", "templates/**/*", '\.pyi?$']
[tool.pytest.ini_options] [tool.pytest.ini_options]