Documentation
¶
Overview ¶
Package validation runs the produced spec through go-openapi/validate and normalises what comes back into findings the TUI can list and navigate to.
This asks a different question from the scanner's own diagnostics. Those say whether the ANNOTATIONS were understood; these say whether the DOCUMENT they produced is a legal Swagger 2.0 spec. A scan can be perfectly clean and still emit something a consumer will reject, which is the gap this closes.
Index ¶
Constants ¶
const RootLabel = "(the whole document)"
RootLabel names what the empty pointer addresses.
An empty pointer is a location, not the absence of one: RFC 6901 spells the whole document that way, and a finding about something the document does not have at all - no info block, no paths - is reported there. It needs a printable stand-in, since "" would render as nothing at all.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render composes the validation tab's body.
It also reports the 0-based content line of the selected finding, or -1 when there is none.
Laid out like the scan tab and coloured by the same rule - label and message in the severity's hue, the selected row taking the whole line over RAW text - so the two tabs read as two views of one pane rather than two widgets.
Types ¶
type Finding ¶
type Finding struct {
Severity grammar.Severity
// Pointer locates the offending value, as an RFC 6901 JSON pointer reported by the validator.
//
// Taken from the result rather than recovered from the message: the validator records the location as it walks, so
// it is the authority on it, and a sentence is a poor place to keep a machine-readable path.
//
// EMPTY means the whole document, which is what RFC 6901 spells that way - not "nowhere". A finding about
// something the document lacks entirely is reported there, so an empty pointer is navigable: see RootLabel.
Pointer string
Message string
}
Finding is one validation result.
Severity reuses the scanner's own enum rather than declaring a parallel one: the two kinds of finding are shown by the same pane in the same colours, and giving "error" two incompatible spellings would only mean translating between them at the one place they meet.