rules

package
v0.0.99 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigSpecURL = "https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/mcp-gateway.md"
	SchemaURL     = "https://raw.githubusercontent.com/github/gh-aw/main/docs/public/schemas/mcp-gateway-config.schema.json"
)

Documentation URL constants

Variables

This section is empty.

Functions

func AppendConfigDocsFooter

func AppendConfigDocsFooter(sb *strings.Builder)

AppendConfigDocsFooter appends standard documentation links to an error message

Types

type ValidationError

type ValidationError struct {
	Field      string
	Message    string
	JSONPath   string
	Suggestion string
}

ValidationError represents a configuration validation error with context. It provides detailed information about what went wrong during configuration validation, including the field that failed, a human-readable message, the JSON path to the error location, and a suggestion for how to fix it.

This error type implements the error interface and formats itself with helpful context when Error() is called, including the JSON path and suggestion if available.

func AbsolutePath

func AbsolutePath(value, fieldName, jsonPath string) *ValidationError

AbsolutePath validates that a directory path is an absolute path Per MCP Gateway schema: Unix paths start with '/', Windows paths start with a drive letter followed by ':\' Pattern: ^(/|[A-Za-z]:\\) Returns nil if valid, *ValidationError if invalid

func MissingRequired

func MissingRequired(fieldName, serverType, jsonPath, suggestion string) *ValidationError

MissingRequired creates a ValidationError for missing required fields

func MountFormat

func MountFormat(mount, jsonPath string, index int) *ValidationError

MountFormat validates a mount specification in the format "source:dest" or "source:dest:mode" Returns nil if valid, *ValidationError if invalid Per MCP Gateway specification v1.7.0 section 4.1.5: - Host path MUST be an absolute path - Container path MUST be an absolute path - Mode (if provided) MUST be either "ro" (read-only) or "rw" (read-write)

func NonEmptyString

func NonEmptyString(value, fieldName, jsonPath string) *ValidationError

NonEmptyString validates that a string field is not empty (minLength: 1) Returns nil if valid, *ValidationError if invalid

func PortRange

func PortRange(port int, jsonPath string) *ValidationError

PortRange validates that a port is in the valid range (1-65535) Returns nil if valid, *ValidationError if invalid

func TimeoutPositive

func TimeoutPositive(timeout int, fieldName, jsonPath string) *ValidationError

TimeoutPositive validates that a timeout value is at least 1 Returns nil if valid, *ValidationError if invalid

func UndefinedVariable

func UndefinedVariable(varName, jsonPath string) *ValidationError

UndefinedVariable creates a ValidationError for undefined environment variables

func UnsupportedField

func UnsupportedField(fieldName, message, jsonPath, suggestion string) *ValidationError

UnsupportedField creates a ValidationError for unsupported fields

func UnsupportedType

func UnsupportedType(fieldName, actualType, jsonPath, suggestion string) *ValidationError

UnsupportedType creates a ValidationError for unsupported type values

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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