Skip to content

public-helpers: rename dazzle.back.print_schema → format_schema (returns str, doesn't print) #1076

@manwithacat

Description

@manwithacat

Proposal

Rename dazzle.back.print_schema to format_schema (or schema_to_text).

- def print_schema(spec: BackendSpec) -> str:
+ def format_schema(spec: BackendSpec) -> str:
      """Render the backend schema as a multi-line string."""
      ...

Why

The current name implies stdout output (Python's print(...) convention). The function actually returns a string — callers have to do their own print(format_schema(spec)) if they want to display it. The companion helper inspect_schema(spec: BackendSpec) -> dict[str, Any] is correctly named (it returns a dict, doesn't side-effect).

Anyone reading the public-helpers list:

- inspect_schema: function (spec: 'BackendSpec') -> 'dict[str, Any]'
- print_schema: function (spec: 'BackendSpec') -> 'str'

…reasonably assumes print_schema writes to stdout. It doesn't. Pre-1.0 cleanup window is the time to fix this.

Blast radius

Top-level export in dazzle.back._LOADERS. Search for current call sites:

grep -rn "print_schema" src/ tests/ examples/ docs/

Likely small — print_schema is a documentation/admin helper, not on a critical render path. Each call site changes from dazzle.back.print_schema(...) to dazzle.back.format_schema(...). Update the _LOADERS mapping in src/dazzle/back/__init__.py. Regenerate the baseline:

dazzle inspect-api public-helpers --write

CHANGELOG entry under Changed + Removed. ADR-0003 (no backward compat shims) applies — clean break.

Companion issues

Same pre-1.0 cleanup spirit; collectively close the audit-surfaced rename pass per /improve cycles 113, 126, 131 (api_surface_audit sub-strategy).

Discovered by

/improve cycle 131 framework-ux lane, api_surface_audit of docs/api-surface/public-helpers.txt. See dev_docs/api-surface-audit-log.md for the cycle's full walk notes (17 entries audited, 1 proposal worth filing).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions