Skip to content

Commit be6bbf2

Browse files
feat: added 1.0.1 arazzo version to spot supported versions rule (#1879)
1 parent 62f6412 commit be6bbf2

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

.changeset/big-kings-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@redocly/openapi-core": patch
3+
---
4+
5+
Added support for Arazzo version 1.0.1 in Spot validation rules.

packages/core/src/rules/arazzo/__tests__/spot-supported-versions.test.ts

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,36 @@ import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../
44
import { BaseResolver } from '../../../resolve';
55

66
describe('Arazzo spot-supported-versions', () => {
7-
const document = parseYamlToDocument(
7+
const documentWithUnsupportedVersion = parseYamlToDocument(
8+
outdent`
9+
arazzo: '1.0.2'
10+
info:
11+
title: Cool API
12+
version: 1.0.0
13+
description: A cool API
14+
sourceDescriptions:
15+
- name: museum-api
16+
type: openapi
17+
url: openapi.yaml
18+
workflows:
19+
- workflowId: get-museum-hours
20+
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
21+
parameters:
22+
- in: header
23+
name: Authorization
24+
value: Basic Og==
25+
steps:
26+
- stepId: get-museum-hours
27+
description: >-
28+
Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description.
29+
operationId: museum-api.getMuseumHours
30+
successCriteria:
31+
- condition: $statusCode == 200
32+
`,
33+
'arazzo.yaml'
34+
);
35+
36+
const documentWithSupportedVersion = parseYamlToDocument(
837
outdent`
938
arazzo: '1.0.1'
1039
info:
@@ -36,7 +65,7 @@ describe('Arazzo spot-supported-versions', () => {
3665
it('should report on arazzo version error', async () => {
3766
const results = await lintDocument({
3867
externalRefResolver: new BaseResolver(),
39-
document,
68+
document: documentWithUnsupportedVersion,
4069
config: await makeConfig({
4170
rules: { 'spot-supported-versions': 'error' },
4271
}),
@@ -52,7 +81,7 @@ describe('Arazzo spot-supported-versions', () => {
5281
"source": "arazzo.yaml",
5382
},
5483
],
55-
"message": "Only 1.0.0 Arazzo version is supported by Spot.",
84+
"message": "Only 1.0.0, 1.0.1 Arazzo versions are supported by Spot.",
5685
"ruleId": "spot-supported-versions",
5786
"severity": "error",
5887
"suggest": [],
@@ -61,10 +90,22 @@ describe('Arazzo spot-supported-versions', () => {
6190
`);
6291
});
6392

64-
it('should not report on arazzo version error', async () => {
93+
it('should not report on arazzo version error when supported version is used', async () => {
94+
const results = await lintDocument({
95+
externalRefResolver: new BaseResolver(),
96+
document: documentWithSupportedVersion,
97+
config: await makeConfig({
98+
rules: { 'spot-supported-versions': 'error' },
99+
}),
100+
});
101+
102+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
103+
});
104+
105+
it('should not report on arazzo version error when rule is not configured', async () => {
65106
const results = await lintDocument({
66107
externalRefResolver: new BaseResolver(),
67-
document,
108+
document: documentWithSupportedVersion,
68109
config: await makeConfig({
69110
rules: {},
70111
}),

packages/core/src/typings/arazzo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ export interface ArazzoDefinition {
167167

168168
export const VERSION_PATTERN = /^1\.0\.\d+(-.+)?$/;
169169

170-
export const ARAZZO_VERSIONS_SUPPORTED_BY_SPOT = ['1.0.0'];
170+
export const ARAZZO_VERSIONS_SUPPORTED_BY_SPOT = ['1.0.0', '1.0.1'];

0 commit comments

Comments
 (0)