diff --git a/docs/@v2/commands/map.md b/docs/@v2/commands/map.md new file mode 100644 index 0000000000..1c836f4f8c --- /dev/null +++ b/docs/@v2/commands/map.md @@ -0,0 +1,198 @@ +# `map` + +## Introduction + +The `map` command generates a structural map of an API description: +a hierarchical tree that mirrors the document, like a sitemap for API tooling and agents. +Every node in the tree represents a retrievable section of the description — an operation, a channel, a named component, a webhook, a server, or a tag — and is addressed by a canonical JSON pointer. + +{% admonition type="warning" name="OpenAPI and AsyncAPI only" %} +The `map` command is considered an experimental feature. +This means it's still a work in progress and may go through major changes. + +It supports OpenAPI 2.0 through 3.2 and AsyncAPI 2.x and 3.0 descriptions. +{% /admonition %} + +The API map is designed as a compact index that tools — including LLM-based agents — can navigate to decide which parts of an API description to retrieve, +instead of processing the whole document. +The tree structure and node summaries are extracted deterministically from the description itself; +no external services are involved unless you opt into [AI refinement](#ai-providers) with `--with-ai`. + +Each node has the following fields: + +| Field | Type | Description | +| ------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| title | string | Human-readable name: the API title, path, `operationId`, channel address, component name, tag name, or server URL. | +| kind | string | Node type name from Redocly's internal type system, for example `Root`, `Info`, `Server`, `Tag`, `Paths`, `PathItem`, `Operation`, `Channel`, `Components`, `NamedSchemas`, or `Schema`. | +| pointer | string | Canonical JSON pointer that identifies and addresses the node, for example `#/paths/~1menu/get`. | +| summary | string | Optional. The node's `summary` field, its `description` truncated at a word boundary (about 200 characters), or a summary derived from the node's structure when neither is present — for example `Returns 200 (MenuItemList). Parameters: limit, sort.` for an operation, or `object: name, price` for a schema. | +| method | string | Optional. HTTP method; present on OpenAPI `Operation` nodes only. | +| path | string | Optional. URL path; present on OpenAPI `Operation` nodes under `paths` only. | +| source | object | Optional. Original `{ file, pointer, startLine, startCol, endLine, endCol }` location of the node; present when `--source-locations` is used. | +| nodes | array | Child nodes. | + +The tree stops at operations, channels, and named components; +parameters, responses, messages payloads, and schema internals are the node's content, retrievable through its pointer. + +{% admonition type="info" name="Pointers are logical" %} +Pointers address the logical document structure as authored. +For multi-file descriptions, note that `redocly bundle` may store referenced components under different keys; +use `--source-locations` when you need the exact file and location of each node. +{% /admonition %} + +## Usage + +```bash +redocly map +redocly map [--format=