Documentation
¶
Index ¶
- Constants
- func AppendConfigDocsFooter(sb *strings.Builder)
- type ValidationError
- func AbsolutePath(value, fieldName, jsonPath string) *ValidationError
- func InvalidPattern(fieldName, value, jsonPath, suggestion string) *ValidationError
- func InvalidValue(fieldName, message, jsonPath, suggestion string) *ValidationError
- func MissingRequired(fieldName, serverType, jsonPath, suggestion string) *ValidationError
- func MountFormat(mount, jsonPath string, index int) *ValidationError
- func NonEmptyString(value, fieldName, jsonPath string) *ValidationError
- func PortRange(port int, jsonPath string) *ValidationError
- func SchemaValidationError(serverType, message, jsonPath, suggestion string) *ValidationError
- func TimeoutPositive(timeout int, fieldName, jsonPath string) *ValidationError
- func UndefinedVariable(varName, jsonPath string) *ValidationError
- func UnsupportedField(fieldName, message, jsonPath, suggestion string) *ValidationError
- func UnsupportedType(fieldName, actualType, jsonPath, suggestion string) *ValidationError
Constants ¶
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/v0.62.2/docs/public/schemas/mcp-gateway-config.schema.json" )
Documentation URL constants
Variables ¶
This section is empty.
Functions ¶
func AppendConfigDocsFooter ¶
AppendConfigDocsFooter appends standard documentation links to an error message
Types ¶
type ValidationError ¶
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 InvalidPattern ¶ added in v0.1.16
func InvalidPattern(fieldName, value, jsonPath, suggestion string) *ValidationError
InvalidPattern creates a ValidationError for values that don't match a required pattern. Used by validation_schema.go for container, mount, URL, and other pattern validations.
func InvalidValue ¶ added in v0.1.16
func InvalidValue(fieldName, message, jsonPath, suggestion string) *ValidationError
InvalidValue creates a ValidationError for field values that violate a constraint. The message describes the specific constraint violation.
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:mode" Returns nil if valid, *ValidationError if invalid Per MCP Gateway specification v1.8.0 section 4.1.5: - Host path MUST be an absolute path - Container path MUST be an absolute path - Mode 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 SchemaValidationError ¶ added in v0.1.16
func SchemaValidationError(serverType, message, jsonPath, suggestion string) *ValidationError
SchemaValidationError creates a ValidationError for custom schema validation failures. Used by validation.go for the various stages of custom schema fetching, parsing, and validation.
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