Documentation
¶
Index ¶
- func ConvertResultIntoDiagnostic(vacuumResult *model.RuleFunctionResult) protocol.Diagnostic
- func ConvertResultsIntoDiagnostics(result *motor.RuleSetExecutionResult) []protocol.Diagnostic
- func GetDiagnosticSeverityFromRule(rule *model.Rule) protocol.DiagnosticSeverity
- func MergeConfig(target, source *LSPConfig)
- type Document
- type DocumentContext
- type DocumentStore
- type LSPConfig
- type RulesetSelector
- type ServerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertResultIntoDiagnostic ¶ added in v0.9.11
func ConvertResultIntoDiagnostic(vacuumResult *model.RuleFunctionResult) protocol.Diagnostic
func ConvertResultsIntoDiagnostics ¶ added in v0.9.11
func ConvertResultsIntoDiagnostics(result *motor.RuleSetExecutionResult) []protocol.Diagnostic
func GetDiagnosticSeverityFromRule ¶ added in v0.9.11
func GetDiagnosticSeverityFromRule(rule *model.Rule) protocol.DiagnosticSeverity
func MergeConfig ¶ added in v0.21.6
func MergeConfig(target, source *LSPConfig)
MergeConfig merges source into target. Non-nil/non-empty values from source override corresponding values in target.
Types ¶
type Document ¶
type Document struct {
URI protocol.DocumentUri
RunningDiagnostic bool
Content string
// contains filtered or unexported fields
}
type DocumentContext ¶ added in v0.20.3
DocumentContext contains details about the file being processed by the LSP. This allows you to add logic to the RulesetSelector based on the file name or content of the document being processed.
type DocumentStore ¶
type DocumentStore struct {
// contains filtered or unexported fields
}
func (*DocumentStore) Remove ¶
func (s *DocumentStore) Remove(uri string)
type LSPConfig ¶ added in v0.21.6
type LSPConfig struct {
// Ruleset specifies a path to a custom ruleset file (local or remote URL)
Ruleset string `json:"ruleset,omitempty"`
// Functions specifies a path to custom function definitions
Functions string `json:"functions,omitempty"`
// Base overrides the base URL/path for resolving references
Base string `json:"base,omitempty"`
// Remote controls whether remote HTTP references are resolved (default: true)
Remote *bool `json:"remote,omitempty"`
// SkipCheck skips OpenAPI document validation
SkipCheck *bool `json:"skipCheck,omitempty"`
// Timeout is the rule execution timeout in seconds (default: 5)
Timeout *int `json:"timeout,omitempty"`
// LookupTimeout is the node lookup timeout in milliseconds
LookupTimeout *int `json:"lookupTimeout,omitempty"`
// HardMode enables all built-in rules including OWASP
HardMode *bool `json:"hardMode,omitempty"`
// IgnoreArrayCircleRef ignores circular array references
IgnoreArrayCircleRef *bool `json:"ignoreArrayCircleRef,omitempty"`
// IgnorePolymorphCircleRef ignores circular polymorphic references
IgnorePolymorphCircleRef *bool `json:"ignorePolymorphCircleRef,omitempty"`
// ExtensionRefs enables $ref lookups for extension objects
ExtensionRefs *bool `json:"extensionRefs,omitempty"`
// IgnoreFile specifies a path to the ignore file
IgnoreFile string `json:"ignoreFile,omitempty"`
// TLS configuration for remote references
CertFile string `json:"certFile,omitempty"`
KeyFile string `json:"keyFile,omitempty"`
CAFile string `json:"caFile,omitempty"`
Insecure *bool `json:"insecure,omitempty"`
}
LSPConfig represents the complete configuration for the vacuum language server. This struct serves as the canonical representation of all configurable options, regardless of whether they come from a config file, InitializationOptions, or workspace/didChangeConfiguration.
func ParseLSPConfig ¶ added in v0.21.6
ParseLSPConfig parses configuration from an arbitrary JSON value. Supports both direct format {"ruleset": "..."} and nested format {"vacuum": {"ruleset": "..."}}.
type RulesetSelector ¶ added in v0.20.3
type RulesetSelector func(ctx *DocumentContext) *rulesets.RuleSet
RulesetSelector is used in NewServerWithRulesetSelector to allow you to dynamically return what rules should be used for the language server diagnostics based on the actual content of the OpenAPI spec being procesed.
type ServerState ¶
type ServerState struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(version string, lintRequest *utils.LintFileRequest) *ServerState
func NewServerWithRulesetSelector ¶ added in v0.20.3
func NewServerWithRulesetSelector(version string, lintRequest *utils.LintFileRequest, selector RulesetSelector) *ServerState
NewServerWithRulesetSelector creates a new instance of the language server with a custom RulsetSelector function to allow you to dynamically select the ruleset used based on the content of the spec being processed.
This allows you to determine specifically what rules should be applied per spec, e.g.:
Have different teams which require different rules? Check the value of info.contact.name in the spec and return the relevant rules for that team.
Want to enable OWASP rules for only a specific server? Check the value of servers[0].url and return the rules including the OWASP ruleset for your specific super secure sever url.
func (*ServerState) Run ¶
func (s *ServerState) Run() error