Built-in UI: expandable operations (v0.6.7)#97
Merged
Conversation
The built-in page was a flat list — fine to skim, but you could not see what an operation takes or returns without opening the raw spec. Each operation is now clickable: it drops down its description, parameters (name, location, type, required), and a generated JSON example of the request body and each response. Examples are built from the schemas with their $refs resolved and recursion capped, so a self-referential type cannot loop. It stays in character: generated examples rather than a full schema table (that is what the rich UIs are for), dependency-free, default collapsed, still a skim-first list. And it stays under the page's strict CSP — no inline styles, the chevron is a cloned inline <svg> template, every value renders through textContent, and the inline script/style hashes are re-pinned. A structural test guards the new markup and a ui-smoke browser test clicks an operation and checks the JSON example panel appears.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #96.
Clicking an operation on the built-in docs page now expands a panel with its description, parameters (name · in · type · required), and a generated JSON example of the request body and each response —
$refs resolved, recursion-capped.Stays in character
<svg>template, every value renders viatextContent, and the inline script/style hashes indefaultDocsCSPare re-pinned.Validation
TestDefaultDocsCSP(hash parity) +TestDefaultUINotice(extended to guard the chevron template /op clickable/buildDetail).TestUISmoke/builtin(renders under CSP),TestDefaultUINoticeDismiss(dismiss + localStorage), and the newTestDefaultUIExpand(clicks an op, asserts the JSON example panel appears).-race,go vet, gofmt, golangci-lint (0 issues with and without theuismoketag). Reviewed live on a complex server before publishing.Cuts v0.6.7.