Documentation
¶
Overview ¶
Package profile provides loading and management of API style profiles.
Package profile provides loading and management of API style profiles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListBuiltin ¶
ListBuiltin returns the names of all built-in profiles.
Types ¶
type Loader ¶
type Loader struct {
// SearchPaths are directories to search for profiles.
SearchPaths []string
}
Loader loads and resolves API style profiles.
type ValidationError ¶ added in v0.4.0
type ValidationError struct {
RuleID string
Field string
Detail string
Warning bool // If true, this is a warning, not an error
}
ValidationError represents a validation error for a profile.
func (ValidationError) Error ¶ added in v0.4.0
func (e ValidationError) Error() string
type ValidationResult ¶ added in v0.4.0
type ValidationResult struct {
Errors []ValidationError
Warnings []ValidationError
}
ValidationResult contains the results of profile validation.
func DisableInvalidRules ¶ added in v0.4.0
func DisableInvalidRules(spec *types.APIStyleSpec) *ValidationResult
DisableInvalidRules modifies the spec in-place to disable rules with invalid JSONPath expressions by changing their enforcement type to "none". This is an alternative to FilterInvalidRules that preserves the rules for LLM evaluation while skipping deterministic linting.
func FilterInvalidRules ¶ added in v0.4.0
func FilterInvalidRules(spec *types.APIStyleSpec) (*types.APIStyleSpec, *ValidationResult)
FilterInvalidRules returns a new spec with invalid rules removed. Invalid rules are those with JSONPath expressions that cannot be parsed. This function also returns the validation result for reporting.
func ValidateProfile ¶ added in v0.4.0
func ValidateProfile(spec *types.APIStyleSpec) *ValidationResult
ValidateProfile validates a profile and returns validation results. It checks for: - Invalid JSONPath expressions in enforcement.given.paths - Missing required fields - Semantic issues
func (*ValidationResult) HasErrors ¶ added in v0.4.0
func (r *ValidationResult) HasErrors() bool
HasErrors returns true if there are any errors.
func (*ValidationResult) HasWarnings ¶ added in v0.4.0
func (r *ValidationResult) HasWarnings() bool
HasWarnings returns true if there are any warnings.