Repository navigation
Show every method of an API operation in one joined chip - #4912
Conversation
An operation that takes GET and POST on one route now shows `POST|GET` everywhere it appears: the operation page, the landing rows, both sidebars and the search route line. The dominant method leads in full colour, and the others follow in a dashed, unfilled chip that joins it on a slanted edge. This replaces the "also GET" text on the operation page. The sidebar reads its methods from the operation's navigation item, so a method from a collapsed sibling now counts. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| public OperationEndpoint Endpoint => field ??= OperationEndpoint.Build(Model, Model.Operation.Description, Siblings); | ||
|
|
||
| // The sidebar chip must list what the page header lists, including methods that come from the description's method listing or from collapsed siblings. | ||
| IReadOnlyList<string> IApiOperationNavigationItem.HttpMethods => Endpoint.Methods; |
There was a problem hiding this comment.
Severity: P3 (Low)
No test covers the fix this PR is about: the sidebar now lists methods from collapsed siblings. OperationEndpointTests calls OperationEndpoint.Build(..., []) with no siblings. The nav rendering tests set HttpMethods on NavigationRenderNode by hand. OperationDeprecatedProjectionTests only checks a single-method leaf. If HttpMethods went back to building without Siblings, or CreateLeaf stopped matching IApiOperationNavigationItem, every test would still pass. Add a projection test that builds the navigation for collapsed operations (for example POST and GET /_search) and checks that the leaf's HttpMethods equals post, get.
Generated by Libra. Specialist: libra-complexity. React with 👍 or 👎 to give feedback on this comment.
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4912/ |


An API operation that takes several methods on one route, such as
POST /_searchandGET /_search, now shows one joined chip (POST|GET) on the operation page, the landing rows, both sidebars and the search route line. The "also GET" text is gone.Affects: API reference, Site UI, Search
Prompt summary: Operations that support several methods only mention the extra ones as "also GET" on the operation page. The ask is a combined method chip that works for any combination and appears everywhere: navigation, search results, the operation page and the landing pages. The dominant method stays on the left and the others read as secondary.
Why
Only the operation page names the extra methods. The sidebar, the landing rows and search show the dominant method alone, so a reader who scans for
GETnever finds_search. The sidebar also builds its method without the operations collapsed onto the page, so it can disagree with the page header.What
One chip for every method
_HttpMethodBadgetakes a list of methods. One method renders exactly the markup it did before. Several methods render a pill of ordinary chips: the dominant method first, in full colour, and the others unfilled with a dashed grey outline. The chips join on a slanted edge, and a tooltip names the main method.EndpointRow.MethodsandOperationEndpoint.Methodssupply the list, dominant method first, then the existing rank order.Every surface renders it
The operation page and the tag landing rows go through
_EndpointPath. The product landing rows, the legacy sidebar glyph, the design-system sidebar label and the searchRouteLineeach render the same pill with their own sizes. Search already stored every method per route, so no reindex is needed.The sidebar reads the navigation item
IApiOperationNavigationModelbecomesIApiOperationNavigationItem, implemented byOperationNavigationItem. ItsHttpMethodscome from the same endpoint the page header uses, so a method from a collapsed sibling counts.Verify
./build.sh servethen open/api/doc/elasticsearch/operation/operation-searchfor the page and sidebar. Search needsassembler buildwithFEATURE_ASSEMBLER_API_EXPLORER=trueagainst the dev index.Check on the preview
POST|GETchip on both request lines and in the sidebar row, with a tooltip namingPOSTas the main method.Clustergroup rows, next to single-method rows.Out of scope:
OpenApiDocumentExporterbuilds each indexed operation without its collapsed siblings. The method listings in the spec descriptions cover the merged operations seen today, so the index already holds both methods.🤖 Generated with Claude Code