Skip to content
v0.1.3

Docs Module API Reference

This section documents the internals of the docs module in Bijux CLI.

bijux_cli.contracts.docs

Defines the contract for the API specification writing service.

This module specifies the DocsProtocol, a formal interface that any service responsible for generating and writing API specification documents (e.g., OpenAPI, JSON Schema) must implement.

DocsProtocol

Bases: Protocol

Defines the contract for writing API specifications.

This interface specifies methods for serializing and writing specification documents, such as OpenAPI or JSON Schema, in various formats.

close

close() -> None

Closes the writer and releases any associated resources.

Source code in src/bijux_cli/contracts/docs.py
def close(self) -> None:
    """Closes the writer and releases any associated resources."""
    ...

write

write(
    spec: dict[str, Any],
    *,
    fmt: OutputFormat = JSON,
    name: str = "spec",
) -> str

Writes a specification to a file.

Parameters:

  • spec (dict[str, Any]) –

    The specification dictionary to write.

  • fmt (OutputFormat, default: JSON ) –

    The output format. Defaults to OutputFormat.JSON.

  • name (str, default: 'spec' ) –

    The base name for the output file. Defaults to 'spec'.

Returns:

  • str ( str ) –

    The path to the written file as a string.

Source code in src/bijux_cli/contracts/docs.py
def write(
    self,
    spec: dict[str, Any],
    *,
    fmt: OutputFormat = OutputFormat.JSON,
    name: str = "spec",
) -> str:
    """Writes a specification to a file.

    Args:
        spec (dict[str, Any]): The specification dictionary to write.
        fmt (OutputFormat): The output format. Defaults to `OutputFormat.JSON`.
        name (str): The base name for the output file. Defaults to 'spec'.

    Returns:
        str: The path to the written file as a string.
    """
    ...

write_sync

write_sync(
    spec: dict[Any, Any],
    fmt: OutputFormat,
    name: str | Path,
) -> Path

Writes the specification to a file synchronously.

Parameters:

  • spec (dict[Any, Any]) –

    The specification dictionary to write.

  • fmt (OutputFormat) –

    The output format (e.g., JSON, YAML).

  • name (str | Path) –

    The path or name for the output file.

Returns:

  • Path ( Path ) –

    The Path object pointing to the written file.

Source code in src/bijux_cli/contracts/docs.py
def write_sync(
    self, spec: dict[Any, Any], fmt: OutputFormat, name: str | Path
) -> Path:
    """Writes the specification to a file synchronously.

    Args:
        spec (dict[Any, Any]): The specification dictionary to write.
        fmt (OutputFormat): The output format (e.g., JSON, YAML).
        name (str | Path): The path or name for the output file.

    Returns:
        Path: The `Path` object pointing to the written file.
    """
    ...