Skip to content

Commit

Permalink
Undo renaming of public field
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin Lobo authored and daveshanley committed Oct 11, 2024
1 parent a389635 commit 298f7f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func lintFile(req utils.LintFileRequest) (int64, int, error) {
result := motor.ApplyRulesToRuleSet(&motor.RuleSetExecution{
RuleSet: req.SelectedRS,
Spec: specBytes,
SpecFilePath: req.FileName,
SpecFileName: req.FileName,
CustomFunctions: req.Functions,
Base: req.BaseFlag,
AllowLookup: req.Remote,
Expand Down
12 changes: 6 additions & 6 deletions motor/rule_applicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type ruleContext struct {
// of ApplyRulesToRuleSet to change, without a huge refactor. The ApplyRulesToRuleSet function only returns a single error also.
type RuleSetExecution struct {
RuleSet *rulesets.RuleSet // The RuleSet in which to apply
SpecFilePath string // The path of the specification file, used to correctly label location
SpecFileName string // The path of the specification file, used to correctly label location
Spec []byte // The raw bytes of the OpenAPI specification.
SpecInfo *datamodel.SpecInfo // Pre-parsed spec-info.
CustomFunctions map[string]model.RuleFunction // custom functions loaded from plugin.
Expand Down Expand Up @@ -109,16 +109,16 @@ func ApplyRulesToRuleSet(execution *RuleSetExecution) *RuleSetExecutionResult {

// create new configurations
indexConfig := index.CreateClosedAPIIndexConfig()
indexConfig.SpecFilePath = execution.SpecFilePath
indexConfig.SpecFilePath = execution.SpecFileName
indexConfigUnresolved := index.CreateClosedAPIIndexConfig()
indexConfigUnresolved.SpecFilePath = execution.SpecFilePath
indexConfigUnresolved.SpecFilePath = execution.SpecFileName

// avoid building the index, we don't need it to run yet.
indexConfig.AvoidBuildIndex = true
//indexConfig.AvoidCircularReferenceCheck = true

docConfig := datamodel.NewDocumentConfiguration()
docConfig.SpecFilePath = execution.SpecFilePath
docConfig.SpecFilePath = execution.SpecFileName
//docConfig.SkipCircularReferenceCheck = true

if execution.IgnoreCircularArrayRef {
Expand Down Expand Up @@ -886,7 +886,7 @@ func removeDuplicates(results *[]model.RuleFunctionResult, rse *RuleSetExecution
origin := idx.FindNodeOrigin(result.StartNode)
if origin != nil {
if filepath.Base(origin.AbsoluteLocation) == "root.yaml" {
origin.AbsoluteLocation = rse.SpecFilePath
origin.AbsoluteLocation = rse.SpecFileName
}
result.Origin = origin
}
Expand Down Expand Up @@ -917,7 +917,7 @@ func removeDuplicates(results *[]model.RuleFunctionResult, rse *RuleSetExecution
origin := idx.FindNodeOrigin(result.StartNode)
if origin != nil {
if filepath.Base(origin.AbsoluteLocation) == "root.yaml" {
origin.AbsoluteLocation = rse.SpecFilePath
origin.AbsoluteLocation = rse.SpecFileName
}
result.Origin = origin
}
Expand Down

0 comments on commit 298f7f3

Please sign in to comment.