Documentation
¶
Overview ¶
Package validation provides config analysis and diagnostics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RedactValue ¶
RedactValue redacts a value for display, showing only first/last chars
Types ¶
type Analysis ¶
type Analysis struct {
Request *domain.Request
Diagnostics []Diagnostic
Warnings []string // parsed-level warnings like missing yapi: v1
Chain []config.ChainStep // Chain steps if this is a chain config
Base *config.ConfigV1 // Base config for chain merging
Expect config.Expectation // Expectations for single request validation
}
Analysis is the shared result type from analyzing a config.
func AnalyzeConfigFile ¶
AnalyzeConfigFile loads a file and analyzes it.
func AnalyzeConfigString ¶
AnalyzeConfigString is the single entrypoint for analyzing YAML config. Both CLI and LSP should call this function.
func (*Analysis) ToJSON ¶
func (a *Analysis) ToJSON() JSONOutput
ToJSON converts the analysis to a JSON-serializable output.
type Diagnostic ¶
type Diagnostic struct {
Severity Severity
Field string // "url", "method", "graphql", "jq_filter", etc
Message string // human readable message
// Optional position info. LSP uses it, CLI may ignore.
Line int // 0-based, -1 if unknown
Col int // 0-based, -1 if unknown
}
Diagnostic is the canonical diagnostic type that both CLI and LSP use.
func ValidateChainAssertions ¶
func ValidateChainAssertions(text string, assertions []string, stepName string) []Diagnostic
ValidateChainAssertions validates JQ syntax for all assertions in chain steps.
func ValidateGraphQLSyntax ¶
func ValidateGraphQLSyntax(fullYaml string, req *domain.Request) []Diagnostic
ValidateGraphQLSyntax validates the GraphQL query syntax if present.
func ValidateJQSyntax ¶
func ValidateJQSyntax(fullYaml string, req *domain.Request) []Diagnostic
ValidateJQSyntax validates the jq filter syntax if present.
type EnvVarInfo ¶
type EnvVarInfo struct {
Name string
Value string // Empty if not defined
IsDefined bool
Line int
Col int
StartIndex int
EndIndex int
}
EnvVarInfo holds information about an env var reference for hover/diagnostics
func FindEnvVarRefs ¶
func FindEnvVarRefs(text string) []EnvVarInfo
FindEnvVarRefs finds all environment variable references in text
type Issue ¶
type Issue struct {
Severity Severity
Field string // e.g. "url", "method", "service"
Message string // human-readable
}
Issue represents a single validation problem.
func ValidateRequest ¶
ValidateRequest performs semantic validation on a domain.Request.
type JSONDiagnostic ¶
type JSONDiagnostic struct {
Severity string `json:"severity"`
Field string `json:"field,omitempty"`
Message string `json:"message"`
Line int `json:"line"`
Col int `json:"col"`
}
JSONDiagnostic is a JSON-serializable diagnostic.
type JSONOutput ¶
type JSONOutput struct {
Valid bool `json:"valid"`
Diagnostics []JSONDiagnostic `json:"diagnostics"`
Warnings []string `json:"warnings"`
}
JSONOutput is the JSON-serializable output for validation results.