Skip to content

API Reference parrot_tools.hooba.spec.prune

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.hooba.spec.prune

View source

Prune Hooba's OpenAPI document to the tags FEAT-602 uses.

Usage::

python -m parrot_tools.hooba.spec.prune --source https://api.hooba.com/api/doc.json --out <file>

Attribute HTTP_METHODS

Type: frozenset[str]

Attribute KEEP_TAGS

Type: tuple[str, ...]

Attribute SERVERS

Function fetch_spec

GET url with aiohttp and return the decoded JSON.

fetch_spec(url: str) -> Dict[str, Any]

Parameter Type Default Description
url str

Returns: Dict[str, Any]

Attribute logger

Function main

CLI entry point; prints the sha256 of the written file.

main(argv: Sequence[str] | None = None) -> int

Parameter Type Default Description
argv Sequence[str] | None None

Returns: int

Function prune_spec

Return a new document with only keep_tags operations and the components they reference.

A path item is kept when at least one of its HTTP-method operations has tags[0] in keep_tags; only those operations (plus the path item's shared, non-method keys) are kept. Component references ($ref) are then collected transitively from the kept paths so every schema/parameter/etc. reachable from a kept operation is preserved, and nothing else is. Keys starting with x- are dropped everywhere. servers is always set to the single Hooba production URL. The result is otherwise a plain, JSON-serializable dict (no in-place mutation of doc), so serializing it with sort_keys=True yields a stable, reproducible document.

prune_spec(doc: Dict[str, Any], keep_tags: Sequence[str] = KEEP_TAGS) -> Dict[str, Any]

Parameter Type Default Description
doc Dict[str, Any] The full, decoded OpenAPI document to prune.
keep_tags Sequence[str] KEEP_TAGS Operation tags to retain; an operation is kept when its first tag is a member.

Returns: Dict[str, Any] — A new, pruned OpenAPI document dict.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally