Current State
- The Layer5 Cloud API Reference is auto-generated from OpenAPI schemas using custom Hugo partials.
- Each endpoint entry displays the resolvable server URL (e.g., Layer5 Cloud local server URL:
http://localhost:9876/api/...), but this is entirely static.
- There is no way to actually send a request from the docs page and see what comes back. A user has to manually copy the URL/parameters into
curl or Postman.
Desired State
On each endpoint's docs page, add an interactive "Try it out" widget. For V1, this feature is strictly scoped to unauthenticated GET endpoints, specifically:
/api/catalog/content/{type}
- (Any other unauthenticated catalog retrieval endpoints)
The interactive widget should:
- Render as a client-side component embedded in the existing Hugo partials.
- Allow the user to target their local dev server (
localhost:9876) or the public production endpoint (https://meshery.layer5.io).
- Render editable input fields for path and query parameters.
- Execute the actual HTTP request client-side (via browser
fetch() from the user's machine to the Cloud instance).
- Display the real status code, headers, and response body dynamically without refreshing the page.
- Fall back gracefully (displaying a clear error message in the UI) when the target server isn't reachable due to CORS failures or connection refused errors.
Why
- Directly enables users testing Layer5 Cloud to understand "what does this endpoint actually return" without leaving the docs.
- Scoping to unauthenticated
GET endpoints for V1 avoids the complexity of injecting authentication tokens and eliminates the risk of accidental data mutation in the database, allowing us to establish the baseline UI safely.
Implementation Plan
- Architecture: Because the REST API Reference is built using custom Hugo partials, this will require injecting a custom vanilla JavaScript bundle or HTML snippet that attaches to the generated endpoint sections.
- Component Logic: The JavaScript should read the parameters from the DOM, construct the
fetch() call to the selected URL, and render the raw response back into the DOM.
- CORS: Ensure the UI clearly instructs users that this only works against instances configured to allow cross-origin requests from the docs site (or against the public catalog endpoints).
- Scoping: Enforce that the "Try it out" button only renders for approved HTTP
GET catalog operations. Do not include token inputs or POST/PUT body editors in this initial PR.
Acceptance Criteria
Mockups
Contributor Guide and Resources
Current State
http://localhost:9876/api/...), but this is entirely static.curlor Postman.Desired State
On each endpoint's docs page, add an interactive "Try it out" widget. For V1, this feature is strictly scoped to unauthenticated
GETendpoints, specifically:/api/catalog/content/{type}The interactive widget should:
localhost:9876) or the public production endpoint (https://meshery.layer5.io).fetch()from the user's machine to the Cloud instance).Why
GETendpoints for V1 avoids the complexity of injecting authentication tokens and eliminates the risk of accidental data mutation in the database, allowing us to establish the baseline UI safely.Implementation Plan
fetch()call to the selected URL, and render the raw response back into the DOM.GETcatalog operations. Do not include token inputs orPOST/PUTbody editors in this initial PR.Acceptance Criteria
GETendpoint pages (e.g./api/catalog/content/{type}) in the Layer5 Cloud REST API Reference.Mockups
Contributor Guide and Resources