Documentation
¶
Overview ¶
Package sitegen generates static HTML documentation sites from IR traffic logs.
Index ¶
- func ComputeDedupKey(record *ir.IRRecord, pathTemplate string) string
- func DeduplicateRequests(records []*StoredRecord) (distinct []*RequestView, deduped *DedupedView)
- func GenerateFromFile(inputPath, outputDir string, opts *Options) error
- type DedupedView
- type EndpointPage
- type Engine
- type Generator
- type Options
- type RequestView
- type SiteData
- type SiteStats
- type StatusGroup
- type StoredRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeDedupKey ¶
ComputeDedupKey computes a deduplication key for a request. The key is based on: method + pathTemplate + sorted query keys + body structure + status.
func DeduplicateRequests ¶
func DeduplicateRequests(records []*StoredRecord) (distinct []*RequestView, deduped *DedupedView)
DeduplicateRequests groups requests and creates both distinct and deduped views.
func GenerateFromFile ¶
GenerateFromFile generates a site from an IR file or directory.
Types ¶
type DedupedView ¶
type DedupedView struct {
Method string
PathTemplate string
PathParamValues map[string][]string // param -> all seen values
QueryParamValues map[string][]string // param -> all seen values
RequestBodyExample any
ResponseBodyExample any
Count int
}
DedupedView shows all variations in a compact format.
type EndpointPage ¶
type EndpointPage struct {
Method string
PathTemplate string
Slug string // URL-safe filename (e.g., "get-users-userid")
RequestCount int
StatusGroups []*StatusGroup
}
EndpointPage represents a single endpoint's page.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine processes IR records and stores them for site generation.
func (*Engine) BuildSiteData ¶
BuildSiteData builds the SiteData from processed records.
func (*Engine) ProcessRecord ¶
ProcessRecord processes a single IR record.
func (*Engine) ProcessRecords ¶
ProcessRecords processes multiple IR records.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates static HTML sites from IR records.
func NewGenerator ¶
NewGenerator creates a new site generator.
func (*Generator) ProcessRecords ¶
ProcessRecords processes IR records for site generation.
type Options ¶
Options configures the site generator.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns the default site generation options.
type RequestView ¶
type RequestView struct {
ID string
Method string
Path string // Original path (not template)
PathTemplate string
PathParams map[string]string
QueryParams map[string]any
RequestHeaders map[string]string
RequestBody any
ResponseHeaders map[string]string
ResponseBody any
StatusCode int
ContentType string
DurationMs float64
DedupKey string
}
RequestView represents a single request for display.
type SiteData ¶
type SiteData struct {
Title string
GeneratedAt time.Time
Endpoints []*EndpointPage
Stats *SiteStats
}
SiteData is the top-level data for template rendering.
type StatusGroup ¶
type StatusGroup struct {
StatusCode int
Distinct []*RequestView // All unique requests
Deduped *DedupedView // Collapsed view with all seen values
}
StatusGroup groups requests by HTTP status code.