Help us shape the future of Go! Take the 2026 Go Developer Survey

model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package model defines evidence-bearing values shared by Radar subsystems.

Index

Constants

View Source
const RepositoryID = "repository"

RepositoryID identifies the repository root node.

Variables

This section is empty.

Functions

func ContractID

func ContractID(schema, pointer string) string

ContractID identifies an explicitly bound schema object.

func EntityID

func EntityID(kind, path, qualified string, occurrence int) string

EntityID identifies a declaration by kind, file and qualified scope. Repeated declarations of the same name receive an occurrence suffix (~1, ~2, ...).

func FileID

func FileID(path string) string

FileID identifies a repository-relative file.

func ModuleID

func ModuleID(language, module string) string

ModuleID identifies an import specifier as written in source.

func PathFromID

func PathFromID(id string) string

PathFromID returns the repository path encoded in a file, declaration or schema identity, or "" when the identity does not name a file.

func SchemaFieldID

func SchemaFieldID(schema, pointer string) string

SchemaFieldID identifies a property of an explicitly bound schema object.

func SortSnapshot

func SortSnapshot(s *Snapshot)

SortSnapshot orders nodes and edges by identity for deterministic output.

func StableID

func StableID(parts ...string) string

Types

type Diagnostic

type Diagnostic struct {
	Path     string   `json:"path,omitempty"`
	Message  string   `json:"message"`
	Severity Severity `json:"severity"`
}

type Edge

type Edge struct {
	ID         string     `json:"id"`
	From       string     `json:"from"`
	To         string     `json:"to"`
	Kind       string     `json:"kind"`
	Provenance Provenance `json:"provenance"`
}

type Evidence

type Evidence string
const (
	VerifiedStatic Evidence = "verified_static"
	VerifiedTool   Evidence = "verified_tool"
	ObservedTest   Evidence = "observed_test"
	Inferred       Evidence = "inferred"
	Proposed       Evidence = "proposed"
	Unknown        Evidence = "unknown"
)

type Finding

type Finding struct {
	ID           string       `json:"id"`
	Severity     Severity     `json:"severity"`
	Evidence     Evidence     `json:"evidence"`
	Code         string       `json:"code"`
	Explanation  string       `json:"explanation"`
	Contract     string       `json:"contract,omitempty"`
	Producer     string       `json:"producer,omitempty"`
	Consumer     string       `json:"consumer,omitempty"`
	Branches     []string     `json:"branches,omitempty"`
	Locations    []Provenance `json:"locations,omitempty"`
	Remediation  string       `json:"remediation,omitempty"`
	Verification string       `json:"verification,omitempty"`
}

func NewFinding

func NewFinding(code, explanation string, evidence Evidence) Finding

type Node

type Node struct {
	ID         string            `json:"id"`
	Kind       string            `json:"kind"`
	Name       string            `json:"name"`
	Language   string            `json:"language,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`
	Provenance Provenance        `json:"provenance"`
}

type Provenance

type Provenance struct {
	Repository string   `json:"repository"`
	Revision   string   `json:"revision"`
	Path       string   `json:"path,omitempty"`
	Line       int      `json:"line,omitempty"`
	EndLine    int      `json:"end_line,omitempty"`
	Method     string   `json:"method"`
	Evidence   Evidence `json:"evidence"`
	Timestamp  string   `json:"timestamp,omitempty"`
}

type Severity

type Severity string

Severity ranks findings and diagnostics.

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
	SeverityInfo    Severity = "info"
)

type Snapshot

type Snapshot struct {
	Repository  string       `json:"repository"`
	Revision    string       `json:"revision"`
	Nodes       []Node       `json:"nodes"`
	Edges       []Edge       `json:"edges"`
	Diagnostics []Diagnostic `json:"diagnostics"`
}

type Status

type Status string

Status is the outcome of a check, report, task or evidence record.

const (
	StatusPassed     Status = "passed"
	StatusFailed     Status = "failed"
	StatusWarning    Status = "warning"
	StatusUnknown    Status = "unknown"
	StatusBlocked    Status = "blocked"
	StatusIncomplete Status = "incomplete"
	StatusTimeout    Status = "timeout"
	StatusError      Status = "error"
)

Jump to

Keyboard shortcuts

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