-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ruleset-migrator): support scoped aliases (#1838)
- Loading branch information
Showing
9 changed files
with
245 additions
and
21 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/ruleset-migrator/src/__tests__/__fixtures__/aliases-variant-1/output.cjs
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,7 @@ | ||
module.exports = { | ||
aliases: { | ||
PathItem: '$.paths[*][*]', | ||
Description: '$..description', | ||
Name: '$..name', | ||
}, | ||
}; |
7 changes: 7 additions & 0 deletions
7
packages/ruleset-migrator/src/__tests__/__fixtures__/aliases-variant-1/output.mjs
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,7 @@ | ||
export default { | ||
aliases: { | ||
PathItem: '$.paths[*][*]', | ||
Description: '$..description', | ||
Name: '$..name', | ||
}, | ||
}; |
4 changes: 4 additions & 0 deletions
4
packages/ruleset-migrator/src/__tests__/__fixtures__/aliases-variant-1/ruleset.yaml
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,4 @@ | ||
aliases: | ||
PathItem: $.paths[*][*] | ||
Description: $..description | ||
Name: $..name |
18 changes: 18 additions & 0 deletions
18
packages/ruleset-migrator/src/__tests__/__fixtures__/aliases-variant-2/output.cjs
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,18 @@ | ||
const { oas2: oas2, oas3_0: oas3_0, oas3_1: oas3_1 } = require('@stoplight/spectral-formats'); | ||
module.exports = { | ||
aliases: { | ||
schema: { | ||
description: 'Foo', | ||
targets: [ | ||
{ | ||
formats: [oas2], | ||
given: '$.definitions[*]', | ||
}, | ||
{ | ||
formats: [oas3_0, oas3_1], | ||
given: '$.components.schemas[*]', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
18 changes: 18 additions & 0 deletions
18
packages/ruleset-migrator/src/__tests__/__fixtures__/aliases-variant-2/output.mjs
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,18 @@ | ||
import { oas2, oas3_0, oas3_1 } from '@stoplight/spectral-formats'; | ||
export default { | ||
aliases: { | ||
schema: { | ||
description: 'Foo', | ||
targets: [ | ||
{ | ||
formats: [oas2], | ||
given: '$.definitions[*]', | ||
}, | ||
{ | ||
formats: [oas3_0, oas3_1], | ||
given: '$.components.schemas[*]', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/ruleset-migrator/src/__tests__/__fixtures__/aliases-variant-2/ruleset.yaml
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,11 @@ | ||
aliases: | ||
schema: | ||
description: Foo | ||
targets: | ||
- formats: | ||
- oas2 | ||
given: $.definitions[*] | ||
- formats: | ||
- oas3.0 | ||
- oas3.1 | ||
given: $.components.schemas[*] |
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