DebugTab
The single public extension point for adding a tab to the Lustro debug UI.
Subclass and register a DebugTab to expose JSON routes and, optionally, an HTML view (via renderContent, renderScript, renderStyles). API-only tabs are valid: leave the render methods at their empty defaults.
A tab declares its routes in routes, and gets the routing, the parameter checks, and its OpenAPI document from the declarations. A tab can also route by hand in handle and give its own document in schema.
Properties
The tab icon, shown before the title in the tab bar. HTML-escaped by the server before render. Nothing shows the icon of a headless tab (see showInTabBar), so such a tab can set any value, such as "".
Whether the tab appears in the tab bar. When false the tab is headless: its routes work and _meta lists it when it has an OpenAPI document, but it has no link in the tab bar and no page: /tab/<id> answers 404, as for an unknown tab.
The human-readable tab title, shown in the tab bar and listed for the tab in GET /api/v1/_meta. HTML-escaped by the server before render. A headless tab (see showInTabBar) must still set it: _meta lists it.
Functions
Handles a debug API request. Return null for a route that the tab does not have, also for a method that a route does not take: the client gets an enveloped 404, or a 405 with an Allow header when the tab's OpenAPI document declares the path with other methods. For that check, one slash at the end of the path does not count, as for the declared routes, so a tab that routes by hand treats items/ as items. Throwing anything, including an Error such as TODO(), produces an enveloped 500. Throwing a DebugResponseException produces its response.
Returns the tab's HTML body. Empty by default (API-only tabs).
Returns the tab's JavaScript. When non-empty it is served at /_view.js; otherwise the static asset is used.
Returns the tab's CSS. When non-empty it is served at /_view.css; otherwise the static asset is used.