-
Notifications
You must be signed in to change notification settings - Fork 199
feat: removed the type:none sourceDescriptions Arazzo extension
#1773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
38d9d69
feat: removed the `type:none` sourceDescriptions Arazzo extension
DmitryAnansky 17c5d19
chore: prettier
DmitryAnansky 31029bb
feat: add sourceDescription empty arazzo rule
DmitryAnansky 00bad20
chore: remove broken link
DmitryAnansky 4eb39ad
chore: docs update
DmitryAnansky 3f5d83a
feat: add different sourceDescription rule
DmitryAnansky a00a856
chore: remove rule description from the docs
DmitryAnansky d4cc844
Update .changeset/dull-pigs-jump.md
DmitryAnansky 9affd5a
Update packages/core/src/rules/arazzo/__tests__/sourceDescriptions-no…
DmitryAnansky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| --- | ||
| "@redocly/cli": patch | ||
| "@redocly/openapi-core": patch | ||
| --- | ||
|
|
||
| Removed the `type:none` sourceDescriptions Arazzo extension. | ||
2 changes: 1 addition & 1 deletion
2
__tests__/check-config/wrong-config-type-extensions-in-assertions/snapshot.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
__tests__/lint-config/invalid-config-assertation-config-type/snapshot.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
106 changes: 106 additions & 0 deletions
106
packages/core/src/rules/arazzo/__tests__/sourceDescriptions-not-empty.test.ts
This file contains hidden or 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,106 @@ | ||
| import { outdent } from 'outdent'; | ||
| import { lintDocument } from '../../../lint'; | ||
| import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils'; | ||
| import { BaseResolver } from '../../../resolve'; | ||
|
|
||
| describe('Arazzo sourceDescriptions-not-empty', () => { | ||
| const document1 = parseYamlToDocument( | ||
| outdent` | ||
| arazzo: '1.0.0' | ||
| info: | ||
| title: Cool API | ||
| version: 1.0.0 | ||
| description: A cool API | ||
| sourceDescriptions: | ||
| - name: museum-api | ||
| type: openapi | ||
| url: openapi.yaml | ||
| - name: museum-api | ||
| type: openapi | ||
| url: openapi.yaml | ||
| workflows: | ||
| - workflowId: get-museum-hours | ||
| description: This workflow demonstrates how to get the museum opening hours and buy tickets. | ||
| parameters: | ||
| - in: header | ||
| name: Authorization | ||
| value: Basic Og== | ||
| steps: | ||
| - stepId: get-museum-hours | ||
| description: >- | ||
| Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description. | ||
| operationId: museum-api.getMuseumHours | ||
| successCriteria: | ||
| - condition: $statusCode == 200 | ||
| `, | ||
| 'arazzo.yaml' | ||
| ); | ||
|
|
||
| const document2 = parseYamlToDocument( | ||
| outdent` | ||
| arazzo: '1.0.0' | ||
| info: | ||
| title: Cool API | ||
| version: 1.0.0 | ||
| description: A cool API | ||
| sourceDescriptions: [] | ||
| workflows: | ||
| - workflowId: get-museum-hours | ||
| description: This workflow demonstrates how to get the museum opening hours and buy tickets. | ||
| parameters: | ||
| - in: header | ||
| name: Authorization | ||
| value: Basic Og== | ||
| steps: | ||
| - stepId: get-museum-hours | ||
| description: >- | ||
| Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description. | ||
| operationId: museum-api.getMuseumHours | ||
| successCriteria: | ||
| - condition: $statusCode == 200 | ||
| `, | ||
| 'arazzo.yaml' | ||
| ); | ||
|
|
||
| it('should not report an error when sourceDescriptions have at leasr one entry.', async () => { | ||
DmitryAnansky marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const results = await lintDocument({ | ||
| externalRefResolver: new BaseResolver(), | ||
| document: document1, | ||
| config: await makeConfig({ | ||
| rules: {}, | ||
| arazzoRules: { 'sourceDescriptions-not-empty': 'error' }, | ||
| }), | ||
| }); | ||
|
|
||
| expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); | ||
| }); | ||
|
|
||
| it('should report an error when sourceDescriptions is empty list.', async () => { | ||
| const results = await lintDocument({ | ||
| externalRefResolver: new BaseResolver(), | ||
| document: document2, | ||
| config: await makeConfig({ | ||
| rules: {}, | ||
| arazzoRules: { 'sourceDescriptions-not-empty': 'error' }, | ||
| }), | ||
| }); | ||
|
|
||
| expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` | ||
| [ | ||
| { | ||
| "location": [ | ||
| { | ||
| "pointer": "#/sourceDescriptions", | ||
| "reportOnKey": false, | ||
| "source": "arazzo.yaml", | ||
| }, | ||
| ], | ||
| "message": "The \`sourceDescriptions\` list must have at least one entry.", | ||
| "ruleId": "sourceDescriptions-not-empty", | ||
| "severity": "error", | ||
| "suggest": [], | ||
| }, | ||
| ] | ||
| `); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.