catalog

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package catalog hosts the machine-readable checks catalog served at GET /api/v1/checks. The JSON file is embedded at compile time, parsed + validated at startup, and exposed both as the parsed Catalog struct (for in-process lookups) and as the original bytes (for direct HTTP serving).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Raw

func Raw() []byte

Raw returns the embedded JSON bytes exactly as shipped. Useful for HTTP handlers that want byte-for-byte output without re-marshalling.

Types

type Catalog

type Catalog struct {
	Version string  `json:"version"`
	Checks  []Check `json:"checks"`
}

Catalog is the parsed contents of checks.json.

func Load

func Load() (*Catalog, error)

Load parses and validates the embedded catalog. Callers usually call it at startup; the returned Catalog is safe to share read-only.

func (*Catalog) ByID

func (c *Catalog) ByID(id string) *Check

ByID returns the catalog entry with the given id, or nil when not found.

func (*Catalog) Validate

func (c *Catalog) Validate() error

Validate ensures structural integrity: a non-empty version, unique IDs, and a non-empty title + remediation summary for every entry.

type Check

type Check struct {
	ID               string      `json:"id"`
	Category         string      `json:"category"`
	Title            string      `json:"title"`
	SeverityWhenFail string      `json:"severity_when_fail"`
	ScoreImpact      string      `json:"score_impact,omitempty"`
	Remediation      Remediation `json:"remediation"`
}

Check is one entry in the catalog.

type Remediation

type Remediation struct {
	Summary        string `json:"summary"`
	ExampleStack   string `json:"example_stack,omitempty"`
	ExampleSnippet string `json:"example_snippet,omitempty"`
}

Remediation is the canonical fix recipe associated with a check.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL