@redocly/openapi-core 1.26.1 → 1.27.1

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/config/all.js +2 -3
  3. package/lib/config/config-resolvers.js +8 -1
  4. package/lib/config/minimal.js +1 -2
  5. package/lib/config/recommended-strict.js +2 -3
  6. package/lib/config/recommended.js +2 -3
  7. package/lib/config/rules.js +3 -0
  8. package/lib/config/spec.js +2 -3
  9. package/lib/config/types.d.ts +2 -3
  10. package/lib/rules/arazzo/index.js +2 -4
  11. package/lib/rules/spot/spot-supported-versions.d.ts +2 -0
  12. package/lib/rules/spot/{version-enum.js → spot-supported-versions.js} +3 -3
  13. package/lib/types/redocly-yaml.d.ts +1 -1
  14. package/lib/types/redocly-yaml.js +1 -2
  15. package/lib/visitors.d.ts +3 -0
  16. package/lib/visitors.js +2 -2
  17. package/lib/walk.js +14 -11
  18. package/package.json +1 -1
  19. package/src/__tests__/walk.test.ts +51 -0
  20. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +4 -6
  21. package/src/config/all.ts +2 -3
  22. package/src/config/config-resolvers.ts +8 -1
  23. package/src/config/minimal.ts +1 -2
  24. package/src/config/recommended-strict.ts +2 -3
  25. package/src/config/recommended.ts +2 -3
  26. package/src/config/rules.ts +3 -1
  27. package/src/config/spec.ts +2 -3
  28. package/src/config/types.ts +2 -6
  29. package/src/rules/arazzo/__tests__/{version-enum.test.ts → spot-supported-versions.test.ts} +3 -3
  30. package/src/rules/arazzo/index.ts +2 -4
  31. package/src/rules/spot/{version-enum.ts → spot-supported-versions.ts} +1 -1
  32. package/src/types/redocly-yaml.ts +1 -2
  33. package/src/visitors.ts +5 -2
  34. package/src/walk.ts +20 -11
  35. package/tsconfig.tsbuildinfo +1 -1
  36. package/lib/rules/spot/parameters-not-in-body.d.ts +0 -2
  37. package/lib/rules/spot/parameters-not-in-body.js +0 -18
  38. package/lib/rules/spot/version-enum.d.ts +0 -2
  39. package/src/rules/arazzo/__tests__/parameters-not-in-body.test.ts +0 -73
  40. package/src/rules/spot/parameters-not-in-body.ts +0 -17
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @redocly/openapi-core
2
2
 
3
+ ## 1.27.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed an issue where running the `preview` command failed because one of its dependencies could not be resolved.
8
+ The issue occurred when Realm was not installed in the `node_modules` of the project.
9
+
10
+ ## 1.27.0
11
+
12
+ ### Minor Changes
13
+
14
+ - Added the ability to override default problem messages for built-in rules.
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated Spot validation rules.
19
+
3
20
  ## 1.26.1
4
21
 
5
22
  ### Patch Changes
package/lib/config/all.js CHANGED
@@ -210,8 +210,7 @@ const all = {
210
210
  },
211
211
  arazzo1Rules: {
212
212
  'criteria-unique': 'error',
213
- 'no-criteria-xpath': 'error',
214
- 'parameters-not-in-body': 'error',
213
+ 'no-criteria-xpath': 'off',
215
214
  'parameters-unique': 'error',
216
215
  'requestBody-replacements-unique': 'error',
217
216
  'sourceDescription-type': 'error',
@@ -220,7 +219,7 @@ const all = {
220
219
  'stepId-unique': 'error',
221
220
  'sourceDescription-name-unique': 'error',
222
221
  'sourceDescriptions-not-empty': 'error',
223
- 'version-enum': 'error',
222
+ 'spot-supported-versions': 'off',
224
223
  'workflowId-unique': 'error',
225
224
  'workflow-dependsOn': 'error',
226
225
  },
@@ -80,7 +80,14 @@ async function resolvePlugins(plugins, configDir = '') {
80
80
  const absolutePluginPath = (0, fs_1.existsSync)(maybeAbsolutePluginPath)
81
81
  ? maybeAbsolutePluginPath
82
82
  : // For plugins imported from packages specifically
83
- require.resolve(plugin, { paths: [configDir] });
83
+ require.resolve(plugin, {
84
+ paths: [
85
+ // Plugins imported from the node_modules in the project directory
86
+ configDir,
87
+ // Plugins imported from the node_modules in the package install directory (for example, npx cache directory)
88
+ __dirname,
89
+ ],
90
+ });
84
91
  if (!pluginsCache.has(absolutePluginPath)) {
85
92
  let requiredPlugin;
86
93
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -187,7 +187,6 @@ const minimal = {
187
187
  arazzo1Rules: {
188
188
  'criteria-unique': 'off',
189
189
  'no-criteria-xpath': 'off',
190
- 'parameters-not-in-body': 'off',
191
190
  'parameters-unique': 'off',
192
191
  'requestBody-replacements-unique': 'off',
193
192
  'sourceDescription-type': 'off',
@@ -196,7 +195,7 @@ const minimal = {
196
195
  'step-onFailure-unique': 'off',
197
196
  'stepId-unique': 'error',
198
197
  'sourceDescription-name-unique': 'off',
199
- 'version-enum': 'off',
198
+ 'spot-supported-versions': 'off',
200
199
  'workflowId-unique': 'error',
201
200
  'workflow-dependsOn': 'off',
202
201
  },
@@ -186,8 +186,7 @@ const recommendedStrict = {
186
186
  },
187
187
  arazzo1Rules: {
188
188
  'criteria-unique': 'error',
189
- 'no-criteria-xpath': 'error',
190
- 'parameters-not-in-body': 'error',
189
+ 'no-criteria-xpath': 'off',
191
190
  'parameters-unique': 'error',
192
191
  'requestBody-replacements-unique': 'error',
193
192
  'sourceDescription-type': 'error',
@@ -196,7 +195,7 @@ const recommendedStrict = {
196
195
  'stepId-unique': 'error',
197
196
  'sourceDescription-name-unique': 'error',
198
197
  'sourceDescriptions-not-empty': 'error',
199
- 'version-enum': 'error',
198
+ 'spot-supported-versions': 'off',
200
199
  'workflowId-unique': 'error',
201
200
  'workflow-dependsOn': 'error',
202
201
  },
@@ -186,8 +186,7 @@ const recommended = {
186
186
  },
187
187
  arazzo1Rules: {
188
188
  'criteria-unique': 'warn',
189
- 'no-criteria-xpath': 'warn',
190
- 'parameters-not-in-body': 'warn',
189
+ 'no-criteria-xpath': 'off',
191
190
  'parameters-unique': 'error',
192
191
  'requestBody-replacements-unique': 'warn',
193
192
  'sourceDescription-type': 'error',
@@ -196,7 +195,7 @@ const recommended = {
196
195
  'stepId-unique': 'error',
197
196
  'sourceDescription-name-unique': 'error',
198
197
  'sourceDescriptions-not-empty': 'error',
199
- 'version-enum': 'warn',
198
+ 'spot-supported-versions': 'off',
200
199
  'workflowId-unique': 'error',
201
200
  'workflow-dependsOn': 'error',
202
201
  },
@@ -15,16 +15,19 @@ function initRules(rules, config, type, oasVersion) {
15
15
  return undefined;
16
16
  }
17
17
  const severity = ruleSettings.severity;
18
+ const message = ruleSettings.message;
18
19
  const visitors = rule(ruleSettings);
19
20
  if (Array.isArray(visitors)) {
20
21
  return visitors.map((visitor) => ({
21
22
  severity,
22
23
  ruleId,
24
+ message,
23
25
  visitor: visitor,
24
26
  }));
25
27
  }
26
28
  return {
27
29
  severity,
30
+ message,
28
31
  ruleId,
29
32
  visitor: visitors, // note: actually it is only one visitor object
30
33
  };
@@ -11,9 +11,8 @@ const spec = {
11
11
  async2Rules: {},
12
12
  async3Rules: {},
13
13
  arazzo1Rules: {
14
- 'parameters-not-in-body': 'error',
15
14
  'sourceDescription-type': 'error',
16
- 'version-enum': 'error',
15
+ 'spot-supported-versions': 'off',
17
16
  'workflowId-unique': 'error',
18
17
  'stepId-unique': 'error',
19
18
  'sourceDescription-name-unique': 'error',
@@ -23,7 +22,7 @@ const spec = {
23
22
  'step-onSuccess-unique': 'error',
24
23
  'step-onFailure-unique': 'error',
25
24
  'requestBody-replacements-unique': 'error',
26
- 'no-criteria-xpath': 'error',
25
+ 'no-criteria-xpath': 'off',
27
26
  'criteria-unique': 'error',
28
27
  },
29
28
  };
@@ -7,11 +7,10 @@ import type { JSONSchema } from 'json-schema-to-ts';
7
7
  export type RuleSeverity = ProblemSeverity | 'off';
8
8
  export type RuleSettings = {
9
9
  severity: RuleSeverity;
10
+ message?: string;
10
11
  };
11
12
  export type PreprocessorSeverity = RuleSeverity | 'on';
12
- export type RuleConfig = RuleSeverity | ({
13
- severity?: ProblemSeverity;
14
- } & Record<string, any>);
13
+ export type RuleConfig = RuleSeverity | (Partial<RuleSettings> & Record<string, any>);
15
14
  export type PreprocessorConfig = PreprocessorSeverity | ({
16
15
  severity?: ProblemSeverity;
17
16
  } & Record<string, any>);
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.preprocessors = exports.rules = void 0;
4
4
  const struct_1 = require("../common/struct");
5
5
  const assertions_1 = require("../common/assertions");
6
- const parameters_not_in_body_1 = require("../spot/parameters-not-in-body");
7
6
  const sourceDescription_type_1 = require("../arazzo/sourceDescription-type");
8
7
  const sourceDescriptions_not_empty_1 = require("./sourceDescriptions-not-empty");
9
- const version_enum_1 = require("../spot/version-enum");
8
+ const spot_supported_versions_1 = require("../spot/spot-supported-versions");
10
9
  const workflowId_unique_1 = require("./workflowId-unique");
11
10
  const stepId_unique_1 = require("./stepId-unique");
12
11
  const sourceDescriptions_name_unique_1 = require("./sourceDescriptions-name-unique");
@@ -20,9 +19,8 @@ const criteria_unique_1 = require("./criteria-unique");
20
19
  exports.rules = {
21
20
  struct: struct_1.Struct,
22
21
  assertions: assertions_1.Assertions,
23
- 'parameters-not-in-body': parameters_not_in_body_1.ParametersNotInBody,
24
22
  'sourceDescription-type': sourceDescription_type_1.SourceDescriptionType,
25
- 'version-enum': version_enum_1.VersionEnum,
23
+ 'spot-supported-versions': spot_supported_versions_1.SpotSupportedVersions,
26
24
  'workflowId-unique': workflowId_unique_1.WorkflowIdUnique,
27
25
  'stepId-unique': stepId_unique_1.StepIdUnique,
28
26
  'sourceDescription-name-unique': sourceDescriptions_name_unique_1.SourceDescriptionsNameUnique,
@@ -0,0 +1,2 @@
1
+ import type { Arazzo1Rule } from '../../visitors';
2
+ export declare const SpotSupportedVersions: Arazzo1Rule;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VersionEnum = void 0;
3
+ exports.SpotSupportedVersions = void 0;
4
4
  const arazzo_1 = require("../../typings/arazzo");
5
5
  const utils_1 = require("../../utils");
6
- const VersionEnum = () => {
6
+ const SpotSupportedVersions = () => {
7
7
  const supportedVersions = arazzo_1.ARAZZO_VERSIONS_SUPPORTED_BY_SPOT.join(', ');
8
8
  return {
9
9
  Root: {
@@ -18,4 +18,4 @@ const VersionEnum = () => {
18
18
  },
19
19
  };
20
20
  };
21
- exports.VersionEnum = VersionEnum;
21
+ exports.SpotSupportedVersions = SpotSupportedVersions;
@@ -9,7 +9,7 @@ declare const builtInAsync2Rules: readonly ["info-contact", "info-license-strict
9
9
  declare const builtInAsync3Rules: readonly ["info-contact", "info-license-strict", "operation-operationId", "tag-description", "tags-alphabetical", "channels-kebab-case", "no-channel-trailing-slash"];
10
10
  export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
11
11
  export type BuiltInAsync3RuleId = typeof builtInAsync3Rules[number];
12
- declare const builtInArazzo1Rules: readonly ["parameters-not-in-body", "sourceDescription-type", "version-enum", "workflowId-unique", "stepId-unique", "sourceDescription-name-unique", "sourceDescriptions-not-empty", "workflow-dependsOn", "parameters-unique", "step-onSuccess-unique", "step-onFailure-unique", "requestBody-replacements-unique", "no-criteria-xpath", "criteria-unique"];
12
+ declare const builtInArazzo1Rules: readonly ["sourceDescription-type", "workflowId-unique", "stepId-unique", "sourceDescription-name-unique", "sourceDescriptions-not-empty", "workflow-dependsOn", "parameters-unique", "step-onSuccess-unique", "step-onFailure-unique", "spot-supported-versions", "requestBody-replacements-unique", "no-criteria-xpath", "criteria-unique"];
13
13
  export type BuiltInArazzo1RuleId = typeof builtInArazzo1Rules[number];
14
14
  declare const oas2NodeTypesList: readonly ["Root", "Tag", "TagList", "ExternalDocs", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Paths", "PathItem", "Parameter", "ParameterList", "ParameterItems", "Operation", "Example", "ExamplesMap", "Examples", "Header", "Responses", "Response", "Schema", "Xml", "SchemaProperties", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedSecuritySchemes", "SecurityScheme", "TagGroup", "TagGroups", "EnumDescriptions", "Logo", "XCodeSample", "XCodeSampleList", "XServer", "XServerList"];
15
15
  export type Oas2NodeType = typeof oas2NodeTypesList[number];
@@ -128,9 +128,7 @@ const builtInAsync3Rules = [
128
128
  'no-channel-trailing-slash',
129
129
  ];
130
130
  const builtInArazzo1Rules = [
131
- 'parameters-not-in-body',
132
131
  'sourceDescription-type',
133
- 'version-enum',
134
132
  'workflowId-unique',
135
133
  'stepId-unique',
136
134
  'sourceDescription-name-unique',
@@ -139,6 +137,7 @@ const builtInArazzo1Rules = [
139
137
  'parameters-unique',
140
138
  'step-onSuccess-unique',
141
139
  'step-onFailure-unique',
140
+ 'spot-supported-versions',
142
141
  'requestBody-replacements-unique',
143
142
  'no-criteria-xpath',
144
143
  'criteria-unique',
package/lib/visitors.d.ts CHANGED
@@ -23,6 +23,7 @@ type VisitFunctionOrObject<T> = VisitFunction<T> | VisitObject<T>;
23
23
  export type VisitorNode<T> = {
24
24
  ruleId: string;
25
25
  severity: ProblemSeverity;
26
+ message?: string;
26
27
  context: VisitorLevelContext | VisitorSkippedLevelContext;
27
28
  depth: number;
28
29
  visit: VisitFunction<T>;
@@ -31,6 +32,7 @@ export type VisitorNode<T> = {
31
32
  type VisitorRefNode = {
32
33
  ruleId: string;
33
34
  severity: ProblemSeverity;
35
+ message?: string;
34
36
  context: VisitorLevelContext;
35
37
  depth: number;
36
38
  visit: VisitRefFunction;
@@ -219,6 +221,7 @@ export type OasDecorator = Oas3Decorator;
219
221
  export type RuleInstanceConfig = {
220
222
  ruleId: string;
221
223
  severity: ProblemSeverity;
224
+ message?: string;
222
225
  };
223
226
  export declare function normalizeVisitors<T extends BaseVisitor>(visitorsConfig: (RuleInstanceConfig & {
224
227
  visitor: NestedVisitObject<unknown, T>;
package/lib/visitors.js CHANGED
@@ -31,8 +31,8 @@ function normalizeVisitors(visitorsConfig, types) {
31
31
  enter: [],
32
32
  leave: [],
33
33
  };
34
- for (const { ruleId, severity, visitor } of visitorsConfig) {
35
- normalizeVisitorLevel({ ruleId, severity }, visitor, null);
34
+ for (const { ruleId, severity, message, visitor } of visitorsConfig) {
35
+ normalizeVisitorLevel({ ruleId, severity, message }, visitor, null);
36
36
  }
37
37
  for (const v of Object.keys(normalizedVisitors)) {
38
38
  normalizedVisitors[v].enter.sort((a, b) => b.depth - a.depth);
package/lib/walk.js CHANGED
@@ -54,9 +54,9 @@ function walkDocument(opts) {
54
54
  const enteredContexts = new Set();
55
55
  if ((0, ref_utils_1.isRef)(node)) {
56
56
  const refEnterVisitors = normalizedVisitors.ref.enter;
57
- for (const { visit: visitor, ruleId, severity, context } of refEnterVisitors) {
57
+ for (const { visit: visitor, ruleId, severity, message, context } of refEnterVisitors) {
58
58
  enteredContexts.add(context);
59
- const report = reportFn.bind(undefined, ruleId, severity);
59
+ const report = reportFn.bind(undefined, ruleId, severity, message);
60
60
  visitor(node, {
61
61
  report,
62
62
  resolve,
@@ -82,7 +82,7 @@ function walkDocument(opts) {
82
82
  const anyEnterVisitors = normalizedVisitors.any.enter;
83
83
  const currentEnterVisitors = anyEnterVisitors.concat(normalizedVisitors[type.name]?.enter || []);
84
84
  const activatedContexts = [];
85
- for (const { context, visit, skip, ruleId, severity } of currentEnterVisitors) {
85
+ for (const { context, visit, skip, ruleId, severity, message } of currentEnterVisitors) {
86
86
  if (ignoredNodes.has(`${currentLocation.absolutePointer}${currentLocation.pointer}`))
87
87
  break;
88
88
  if (context.isSkippedLevel) {
@@ -127,7 +127,7 @@ function walkDocument(opts) {
127
127
  if (!activatedOn.skipped) {
128
128
  visitedBySome = true;
129
129
  enteredContexts.add(context);
130
- visitWithContext(visit, resolvedNode, node, context, ruleId, severity);
130
+ visitWithContext(visit, resolvedNode, node, context, ruleId, severity, message);
131
131
  }
132
132
  }
133
133
  }
@@ -209,18 +209,18 @@ function walkDocument(opts) {
209
209
  }
210
210
  }
211
211
  }
212
- for (const { context, visit, ruleId, severity } of currentLeaveVisitors) {
212
+ for (const { context, visit, ruleId, severity, message } of currentLeaveVisitors) {
213
213
  if (!context.isSkippedLevel && enteredContexts.has(context)) {
214
- visitWithContext(visit, resolvedNode, node, context, ruleId, severity);
214
+ visitWithContext(visit, resolvedNode, node, context, ruleId, severity, message);
215
215
  }
216
216
  }
217
217
  }
218
218
  currentLocation = location;
219
219
  if ((0, ref_utils_1.isRef)(node)) {
220
220
  const refLeaveVisitors = normalizedVisitors.ref.leave;
221
- for (const { visit: visitor, ruleId, severity, context } of refLeaveVisitors) {
221
+ for (const { visit: visitor, ruleId, severity, context, message } of refLeaveVisitors) {
222
222
  if (enteredContexts.has(context)) {
223
- const report = reportFn.bind(undefined, ruleId, severity);
223
+ const report = reportFn.bind(undefined, ruleId, severity, message);
224
224
  visitor(node, {
225
225
  report,
226
226
  resolve,
@@ -238,8 +238,8 @@ function walkDocument(opts) {
238
238
  }
239
239
  }
240
240
  // returns true ignores all the next visitors on the specific node
241
- function visitWithContext(visit, resolvedNode, node, context, ruleId, severity) {
242
- const report = reportFn.bind(undefined, ruleId, severity);
241
+ function visitWithContext(visit, resolvedNode, node, context, ruleId, severity, customMessage) {
242
+ const report = reportFn.bind(undefined, ruleId, severity, customMessage);
243
243
  visit(resolvedNode, {
244
244
  report,
245
245
  resolve,
@@ -257,7 +257,7 @@ function walkDocument(opts) {
257
257
  getVisitorData: getVisitorDataFn.bind(undefined, ruleId),
258
258
  }, collectParents(context), context);
259
259
  }
260
- function reportFn(ruleId, severity, opts) {
260
+ function reportFn(ruleId, severity, customMessage, opts) {
261
261
  const normalizedLocation = opts.location
262
262
  ? Array.isArray(opts.location)
263
263
  ? opts.location
@@ -274,6 +274,9 @@ function walkDocument(opts) {
274
274
  ruleId: opts.ruleId || ruleId,
275
275
  severity: ruleSeverity,
276
276
  ...opts,
277
+ message: customMessage
278
+ ? customMessage.replace('{{message}}', opts.message)
279
+ : opts.message,
277
280
  suggest: opts.suggest || [],
278
281
  location,
279
282
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-core",
3
- "version": "1.26.1",
3
+ "version": "1.27.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "engines": {
@@ -12,6 +12,7 @@ import {
12
12
  import { BaseResolver, Document } from '../resolve';
13
13
  import { listOf } from '../types';
14
14
  import { Oas3RuleSet } from '../oas-types';
15
+ import { createConfig } from '../config';
15
16
 
16
17
  describe('walk order', () => {
17
18
  it('should run visitors', async () => {
@@ -1338,6 +1339,56 @@ describe('context.report', () => {
1338
1339
  ]
1339
1340
  `);
1340
1341
  });
1342
+
1343
+ it('should report errors with custom messages', async () => {
1344
+ const document = parseYamlToDocument(
1345
+ outdent`
1346
+ openapi: 3.0.0
1347
+ info:
1348
+ license: {}
1349
+ paths: {}
1350
+ `,
1351
+ 'foobar.yaml'
1352
+ );
1353
+
1354
+ const config = await createConfig(`
1355
+ rules:
1356
+ info-contact:
1357
+ message: "MY ERR DESCRIPTION: {{message}}"
1358
+ severity: "error"
1359
+ `);
1360
+
1361
+ const results = await lintDocument({
1362
+ externalRefResolver: new BaseResolver(),
1363
+ document,
1364
+ config: config.styleguide,
1365
+ });
1366
+
1367
+ expect(results).toMatchInlineSnapshot(`
1368
+ [
1369
+ {
1370
+ "location": [
1371
+ {
1372
+ "pointer": "#/info/contact",
1373
+ "reportOnKey": true,
1374
+ "source": Source {
1375
+ "absoluteRef": "foobar.yaml",
1376
+ "body": "openapi: 3.0.0
1377
+ info:
1378
+ license: {}
1379
+ paths: {}",
1380
+ "mimeType": undefined,
1381
+ },
1382
+ },
1383
+ ],
1384
+ "message": "MY ERR DESCRIPTION: Info object should contain \`contact\` field.",
1385
+ "ruleId": "info-contact",
1386
+ "severity": "error",
1387
+ "suggest": [],
1388
+ },
1389
+ ]
1390
+ `);
1391
+ });
1341
1392
  });
1342
1393
 
1343
1394
  describe('context.resolve', () => {
@@ -6,17 +6,16 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
6
6
  "arazzo1Preprocessors": {},
7
7
  "arazzo1Rules": {
8
8
  "criteria-unique": "warn",
9
- "no-criteria-xpath": "warn",
10
- "parameters-not-in-body": "warn",
9
+ "no-criteria-xpath": "off",
11
10
  "parameters-unique": "error",
12
11
  "requestBody-replacements-unique": "warn",
13
12
  "sourceDescription-name-unique": "error",
14
13
  "sourceDescription-type": "error",
15
14
  "sourceDescriptions-not-empty": "error",
15
+ "spot-supported-versions": "off",
16
16
  "step-onFailure-unique": "warn",
17
17
  "step-onSuccess-unique": "warn",
18
18
  "stepId-unique": "error",
19
- "version-enum": "warn",
20
19
  "workflow-dependsOn": "error",
21
20
  "workflowId-unique": "error",
22
21
  },
@@ -233,17 +232,16 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
233
232
  "arazzo1Preprocessors": {},
234
233
  "arazzo1Rules": {
235
234
  "criteria-unique": "warn",
236
- "no-criteria-xpath": "warn",
237
- "parameters-not-in-body": "warn",
235
+ "no-criteria-xpath": "off",
238
236
  "parameters-unique": "error",
239
237
  "requestBody-replacements-unique": "warn",
240
238
  "sourceDescription-name-unique": "error",
241
239
  "sourceDescription-type": "error",
242
240
  "sourceDescriptions-not-empty": "error",
241
+ "spot-supported-versions": "off",
243
242
  "step-onFailure-unique": "warn",
244
243
  "step-onSuccess-unique": "warn",
245
244
  "stepId-unique": "error",
246
- "version-enum": "warn",
247
245
  "workflow-dependsOn": "error",
248
246
  "workflowId-unique": "error",
249
247
  },
package/src/config/all.ts CHANGED
@@ -210,8 +210,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
210
210
  },
211
211
  arazzo1Rules: {
212
212
  'criteria-unique': 'error',
213
- 'no-criteria-xpath': 'error',
214
- 'parameters-not-in-body': 'error',
213
+ 'no-criteria-xpath': 'off',
215
214
  'parameters-unique': 'error',
216
215
  'requestBody-replacements-unique': 'error',
217
216
  'sourceDescription-type': 'error',
@@ -220,7 +219,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
220
219
  'stepId-unique': 'error',
221
220
  'sourceDescription-name-unique': 'error',
222
221
  'sourceDescriptions-not-empty': 'error',
223
- 'version-enum': 'error',
222
+ 'spot-supported-versions': 'off',
224
223
  'workflowId-unique': 'error',
225
224
  'workflow-dependsOn': 'error',
226
225
  },
@@ -136,7 +136,14 @@ export async function resolvePlugins(
136
136
  const absolutePluginPath = existsSync(maybeAbsolutePluginPath)
137
137
  ? maybeAbsolutePluginPath
138
138
  : // For plugins imported from packages specifically
139
- require.resolve(plugin, { paths: [configDir] });
139
+ require.resolve(plugin, {
140
+ paths: [
141
+ // Plugins imported from the node_modules in the project directory
142
+ configDir,
143
+ // Plugins imported from the node_modules in the package install directory (for example, npx cache directory)
144
+ __dirname,
145
+ ],
146
+ });
140
147
 
141
148
  if (!pluginsCache.has(absolutePluginPath)) {
142
149
  let requiredPlugin: ImportedPlugin | undefined;
@@ -187,7 +187,6 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
187
187
  arazzo1Rules: {
188
188
  'criteria-unique': 'off',
189
189
  'no-criteria-xpath': 'off',
190
- 'parameters-not-in-body': 'off',
191
190
  'parameters-unique': 'off',
192
191
  'requestBody-replacements-unique': 'off',
193
192
  'sourceDescription-type': 'off',
@@ -196,7 +195,7 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
196
195
  'step-onFailure-unique': 'off',
197
196
  'stepId-unique': 'error',
198
197
  'sourceDescription-name-unique': 'off',
199
- 'version-enum': 'off',
198
+ 'spot-supported-versions': 'off',
200
199
  'workflowId-unique': 'error',
201
200
  'workflow-dependsOn': 'off',
202
201
  },
@@ -186,8 +186,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
186
186
  },
187
187
  arazzo1Rules: {
188
188
  'criteria-unique': 'error',
189
- 'no-criteria-xpath': 'error',
190
- 'parameters-not-in-body': 'error',
189
+ 'no-criteria-xpath': 'off',
191
190
  'parameters-unique': 'error',
192
191
  'requestBody-replacements-unique': 'error',
193
192
  'sourceDescription-type': 'error',
@@ -196,7 +195,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
196
195
  'stepId-unique': 'error',
197
196
  'sourceDescription-name-unique': 'error',
198
197
  'sourceDescriptions-not-empty': 'error',
199
- 'version-enum': 'error',
198
+ 'spot-supported-versions': 'off',
200
199
  'workflowId-unique': 'error',
201
200
  'workflow-dependsOn': 'error',
202
201
  },
@@ -186,8 +186,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
186
186
  },
187
187
  arazzo1Rules: {
188
188
  'criteria-unique': 'warn',
189
- 'no-criteria-xpath': 'warn',
190
- 'parameters-not-in-body': 'warn',
189
+ 'no-criteria-xpath': 'off',
191
190
  'parameters-unique': 'error',
192
191
  'requestBody-replacements-unique': 'warn',
193
192
  'sourceDescription-type': 'error',
@@ -196,7 +195,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
196
195
  'stepId-unique': 'error',
197
196
  'sourceDescription-name-unique': 'error',
198
197
  'sourceDescriptions-not-empty': 'error',
199
- 'version-enum': 'warn',
198
+ 'spot-supported-versions': 'off',
200
199
  'workflowId-unique': 'error',
201
200
  'workflow-dependsOn': 'error',
202
201
  },
@@ -39,19 +39,21 @@ export function initRules(
39
39
  return undefined;
40
40
  }
41
41
  const severity: ProblemSeverity = ruleSettings.severity;
42
-
42
+ const message = ruleSettings.message;
43
43
  const visitors = rule(ruleSettings);
44
44
 
45
45
  if (Array.isArray(visitors)) {
46
46
  return visitors.map((visitor: any) => ({
47
47
  severity,
48
48
  ruleId,
49
+ message,
49
50
  visitor: visitor,
50
51
  }));
51
52
  }
52
53
 
53
54
  return {
54
55
  severity,
56
+ message,
55
57
  ruleId,
56
58
  visitor: visitors, // note: actually it is only one visitor object
57
59
  };
@@ -11,9 +11,8 @@ const spec: PluginStyleguideConfig<'built-in'> = {
11
11
  async2Rules: {},
12
12
  async3Rules: {},
13
13
  arazzo1Rules: {
14
- 'parameters-not-in-body': 'error',
15
14
  'sourceDescription-type': 'error',
16
- 'version-enum': 'error',
15
+ 'spot-supported-versions': 'off',
17
16
  'workflowId-unique': 'error',
18
17
  'stepId-unique': 'error',
19
18
  'sourceDescription-name-unique': 'error',
@@ -23,7 +22,7 @@ const spec: PluginStyleguideConfig<'built-in'> = {
23
22
  'step-onSuccess-unique': 'error',
24
23
  'step-onFailure-unique': 'error',
25
24
  'requestBody-replacements-unique': 'error',
26
- 'no-criteria-xpath': 'error',
25
+ 'no-criteria-xpath': 'off',
27
26
  'criteria-unique': 'error',
28
27
  },
29
28
  };
@@ -26,15 +26,11 @@ import type { JSONSchema } from 'json-schema-to-ts';
26
26
 
27
27
  export type RuleSeverity = ProblemSeverity | 'off';
28
28
 
29
- export type RuleSettings = { severity: RuleSeverity };
29
+ export type RuleSettings = { severity: RuleSeverity; message?: string };
30
30
 
31
31
  export type PreprocessorSeverity = RuleSeverity | 'on';
32
32
 
33
- export type RuleConfig =
34
- | RuleSeverity
35
- | ({
36
- severity?: ProblemSeverity;
37
- } & Record<string, any>);
33
+ export type RuleConfig = RuleSeverity | (Partial<RuleSettings> & Record<string, any>);
38
34
 
39
35
  export type PreprocessorConfig =
40
36
  | PreprocessorSeverity