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 Exemplar ¶ added in v0.5.0
type Exemplar struct {
// Name is the exemplar identifier (e.g., "default-minimal")
Name string `json:"name"`
// Profile is the style profile this exemplar conforms to
Profile string `json:"profile"`
// Description is a human-readable description
Description string `json:"description"`
// Content is the raw OpenAPI specification content
Content []byte `json:"-"`
}
Exemplar represents an exemplar OpenAPI specification.
func GetExemplar ¶ added in v0.5.0
GetExemplar loads a specific exemplar by name.
func ListExemplars ¶ added in v0.5.0
ListExemplars returns all built-in exemplar specifications.
func ListExemplarsForProfile ¶ added in v0.5.0
ListExemplarsForProfile returns exemplars for a specific profile.
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.