@redocly/openapi-core 1.26.1 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/lib/config/all.js +2 -3
- package/lib/config/minimal.js +1 -2
- package/lib/config/recommended-strict.js +2 -3
- package/lib/config/recommended.js +2 -3
- package/lib/config/rules.js +3 -0
- package/lib/config/spec.js +2 -3
- package/lib/config/types.d.ts +2 -3
- package/lib/rules/arazzo/index.js +2 -4
- package/lib/rules/spot/spot-supported-versions.d.ts +2 -0
- package/lib/rules/spot/{version-enum.js → spot-supported-versions.js} +3 -3
- package/lib/types/redocly-yaml.d.ts +1 -1
- package/lib/types/redocly-yaml.js +1 -2
- package/lib/visitors.d.ts +3 -0
- package/lib/visitors.js +2 -2
- package/lib/walk.js +14 -11
- package/package.json +1 -1
- package/src/__tests__/walk.test.ts +51 -0
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +4 -6
- package/src/config/all.ts +2 -3
- package/src/config/minimal.ts +1 -2
- package/src/config/recommended-strict.ts +2 -3
- package/src/config/recommended.ts +2 -3
- package/src/config/rules.ts +3 -1
- package/src/config/spec.ts +2 -3
- package/src/config/types.ts +2 -6
- package/src/rules/arazzo/__tests__/{version-enum.test.ts → spot-supported-versions.test.ts} +3 -3
- package/src/rules/arazzo/index.ts +2 -4
- package/src/rules/spot/{version-enum.ts → spot-supported-versions.ts} +1 -1
- package/src/types/redocly-yaml.ts +1 -2
- package/src/visitors.ts +5 -2
- package/src/walk.ts +20 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/spot/parameters-not-in-body.d.ts +0 -2
- package/lib/rules/spot/parameters-not-in-body.js +0 -18
- package/lib/rules/spot/version-enum.d.ts +0 -2
- package/src/rules/arazzo/__tests__/parameters-not-in-body.test.ts +0 -73
- package/src/rules/spot/parameters-not-in-body.ts +0 -17
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParametersNotInBody = void 0;
|
|
4
|
-
const ParametersNotInBody = () => {
|
|
5
|
-
return {
|
|
6
|
-
Parameter: {
|
|
7
|
-
enter(parameter, { report, location }) {
|
|
8
|
-
if (parameter.in === 'body') {
|
|
9
|
-
report({
|
|
10
|
-
message: 'The `body` value of the `in` property is not supported by Spot.',
|
|
11
|
-
location: location.child(['in']),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.ParametersNotInBody = ParametersNotInBody;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { outdent } from 'outdent';
|
|
2
|
-
import { lintDocument } from '../../../lint';
|
|
3
|
-
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
|
|
4
|
-
import { BaseResolver } from '../../../resolve';
|
|
5
|
-
|
|
6
|
-
describe('Spot parameters-not-in-body', () => {
|
|
7
|
-
const document = parseYamlToDocument(
|
|
8
|
-
outdent`
|
|
9
|
-
arazzo: '1.0.0'
|
|
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: body
|
|
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
|
-
it('should not report on `body` inside parameter `in` field', async () => {
|
|
37
|
-
const results = await lintDocument({
|
|
38
|
-
externalRefResolver: new BaseResolver(),
|
|
39
|
-
document,
|
|
40
|
-
config: await makeConfig({ rules: {} }),
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should report on `body` inside parameter `in` field', async () => {
|
|
47
|
-
const results = await lintDocument({
|
|
48
|
-
externalRefResolver: new BaseResolver(),
|
|
49
|
-
document,
|
|
50
|
-
config: await makeConfig({
|
|
51
|
-
rules: { 'parameters-not-in-body': 'error' },
|
|
52
|
-
}),
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
56
|
-
[
|
|
57
|
-
{
|
|
58
|
-
"location": [
|
|
59
|
-
{
|
|
60
|
-
"pointer": "#/workflows/0/parameters/0/in",
|
|
61
|
-
"reportOnKey": false,
|
|
62
|
-
"source": "arazzo.yaml",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
"message": "The \`body\` value of the \`in\` property is not supported by Spot.",
|
|
66
|
-
"ruleId": "parameters-not-in-body",
|
|
67
|
-
"severity": "error",
|
|
68
|
-
"suggest": [],
|
|
69
|
-
},
|
|
70
|
-
]
|
|
71
|
-
`);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
-
import type { UserContext } from '../../walk';
|
|
3
|
-
|
|
4
|
-
export const ParametersNotInBody: Arazzo1Rule = () => {
|
|
5
|
-
return {
|
|
6
|
-
Parameter: {
|
|
7
|
-
enter(parameter, { report, location }: UserContext) {
|
|
8
|
-
if (parameter.in === 'body') {
|
|
9
|
-
report({
|
|
10
|
-
message: 'The `body` value of the `in` property is not supported by Spot.',
|
|
11
|
-
location: location.child(['in']),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
};
|