Skip to content

Improve type annotation and docstring for dump_openapi_schema in openapi_schema_dumper.py #2111

Description

@coderabbitai

Summary

In src/utils/openapi_schema_dumper.py, the dump_openapi_schema function's models parameter is typed as a bare list, which lacks a type parameter and does not fully satisfy the coding guideline requiring complete type annotations for all function parameters. Additionally, the docstring is missing a Returns: section, which is required per project conventions and is present in the docstrings of config_dumper.py and models_dumper.py.

Affected code

  • File: src/utils/openapi_schema_dumper.py
  • Function: dump_openapi_schema(models: list, filename: str) -> None

Required changes

  • Update the models parameter annotation to a parameterized type, e.g. list[type[BaseModel]] (importing BaseModel from pydantic if not already imported).
  • Add a Returns: section to the docstring documenting the None return value, matching the style used in config_dumper.py and models_dumper.py.

Rationale

Ensures consistency with the project's coding guidelines requiring complete type annotations and full Google-style docstrings (with Parameters:, Returns:, and Raises: sections where applicable).

Acceptance criteria

  • models parameter has a complete, parameterized type annotation.
  • Docstring includes a Returns: section.
  • No behavioral changes to dump_openapi_schema.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions