-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: nested extends broken in rulesets (#1465)
* fix(ruleset): nested extends not working correctly * Update src/rule.ts Co-authored-by: Domagoj Kriskovic <dom@stoplight.io> Co-authored-by: Domagoj Kriskovic <dom@stoplight.io>
- Loading branch information
Showing
36 changed files
with
501 additions
and
915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions
25
src/rulesets/__tests__/__fixtures__/customFunctionsRuleset/ruleset.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"functionsDir": "./customFunctions", | ||
"functions": [ | ||
"bar", | ||
"truthy" | ||
], | ||
"rules": { | ||
"bar-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"recommended": true, | ||
"then": { | ||
"function": "bar" | ||
} | ||
}, | ||
"truthy-rule": { | ||
"message": "should be OK", | ||
"given": "$.x", | ||
"recommended": true, | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"formats": ["oas2"], | ||
"rules": { | ||
"oas2-valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"formats": ["oas3"], | ||
"rules": { | ||
"oas3-valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": ["./oas2.json", "./oas3.json"], | ||
"formats": ["oas2", "oas3"], | ||
"rules": { | ||
"generic-valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
3 changes: 0 additions & 3 deletions
3
src/rulesets/__tests__/__fixtures__/inheritanceRulesets/my-ruleset-recommended.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/rulesets/__tests__/__fixtures__/inheritanceRulesets/my-ruleset.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/rulesets/__tests__/__fixtures__/inheritanceRulesets/ruleset-b.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/rulesets/__tests__/__fixtures__/inheritanceRulesets/ruleset-c.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["example-spectral-ruleset"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["example-spectral-ruleset@0.0.3"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": [["./shared.json", "all"]], | ||
"rules": { | ||
"description-matches-stoplight": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./shared.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "./off.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": [["./shared.json", "off"]], | ||
"rules": { | ||
"overridable-rule": true | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/rulesets/__tests__/__fixtures__/severity/recommended.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": [["shared.json", "recommended"]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/rulesets/__tests__/__fixtures__/valid-flat-ruleset-2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"rules": { | ||
"valid-rule-2": { | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,10 @@ | ||
{ | ||
"rules": { | ||
"valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
}, | ||
"valid-rule-recommended": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"recommended": true, | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"formats": ["oas2"], | ||
"rules": { | ||
"oas2-valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"formats": ["oas3"], | ||
"rules": { | ||
"oas3-valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": ["./oas2.json", "./oas3.json"], | ||
"formats": ["oas2", "oas3"], | ||
"rules": { | ||
"generic-valid-rule": { | ||
"message": "should be OK", | ||
"given": "$.info", | ||
"then": { | ||
"function": "truthy" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.