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 ¶
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
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.