@redocly/openapi-core 1.0.0-beta.105 → 1.0.0-beta.106

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 (189) hide show
  1. package/README.md +4 -4
  2. package/__tests__/utils.ts +5 -5
  3. package/lib/benchmark/benches/recommended-oas3.bench.js +1 -1
  4. package/lib/benchmark/utils.d.ts +2 -2
  5. package/lib/benchmark/utils.js +2 -2
  6. package/lib/bundle.d.ts +2 -2
  7. package/lib/bundle.js +2 -2
  8. package/lib/config/all.d.ts +2 -2
  9. package/lib/config/all.js +1 -1
  10. package/lib/config/builtIn.d.ts +2 -2
  11. package/lib/config/builtIn.js +2 -2
  12. package/lib/config/config-resolvers.d.ts +5 -5
  13. package/lib/config/config-resolvers.js +39 -36
  14. package/lib/config/config.d.ts +5 -5
  15. package/lib/config/config.js +4 -4
  16. package/lib/config/load.js +4 -4
  17. package/lib/config/minimal.d.ts +2 -2
  18. package/lib/config/minimal.js +1 -1
  19. package/lib/config/recommended.d.ts +2 -2
  20. package/lib/config/recommended.js +1 -1
  21. package/lib/config/rules.d.ts +2 -2
  22. package/lib/config/rules.js +1 -1
  23. package/lib/config/types.d.ts +23 -19
  24. package/lib/config/utils.d.ts +5 -5
  25. package/lib/config/utils.js +43 -26
  26. package/lib/decorators/common/remove-x-internal.js +2 -2
  27. package/lib/format/format.js +1 -1
  28. package/lib/index.d.ts +1 -1
  29. package/lib/index.js +2 -2
  30. package/lib/js-yaml/index.js +1 -6
  31. package/lib/lint.d.ts +2 -2
  32. package/lib/lint.js +16 -6
  33. package/lib/redocly/registry-api.d.ts +1 -1
  34. package/lib/redocly/registry-api.js +2 -2
  35. package/lib/rules/common/info-license-url.d.ts +1 -1
  36. package/lib/rules/common/info-license-url.js +5 -10
  37. package/lib/rules/common/info-license.d.ts +2 -0
  38. package/lib/rules/common/info-license.js +17 -0
  39. package/lib/rules/common/no-enum-type-mismatch.js +1 -3
  40. package/lib/rules/common/operation-operationId.js +1 -1
  41. package/lib/rules/common/path-not-include-query.js +1 -1
  42. package/lib/rules/common/paths-kebab-case.js +4 -1
  43. package/lib/rules/common/spec.js +1 -1
  44. package/lib/rules/oas2/index.js +4 -4
  45. package/lib/rules/oas2/remove-unused-components.js +3 -3
  46. package/lib/rules/oas3/index.js +4 -4
  47. package/lib/rules/oas3/no-empty-servers.js +1 -1
  48. package/lib/rules/oas3/remove-unused-components.js +2 -2
  49. package/lib/rules/other/stats.js +43 -14
  50. package/lib/rules/utils.d.ts +1 -1
  51. package/lib/rules/utils.js +4 -1
  52. package/lib/types/index.d.ts +2 -2
  53. package/lib/types/redocly-yaml.js +8 -7
  54. package/package.json +1 -1
  55. package/src/__tests__/__snapshots__/bundle.test.ts.snap +141 -0
  56. package/src/__tests__/bundle.test.ts +68 -34
  57. package/src/__tests__/codeframes.test.ts +13 -14
  58. package/src/__tests__/js-yaml.test.ts +6 -4
  59. package/src/__tests__/lint.test.ts +74 -6
  60. package/src/__tests__/login.test.ts +2 -2
  61. package/src/__tests__/normalizeVisitors.test.ts +4 -4
  62. package/src/__tests__/ref-utils.test.ts +13 -13
  63. package/src/__tests__/resolve-http.test.ts +1 -1
  64. package/src/__tests__/resolve.test.ts +14 -11
  65. package/src/__tests__/walk.test.ts +48 -56
  66. package/src/benchmark/benches/lint-with-many-rules.bench.ts +1 -1
  67. package/src/benchmark/benches/lint-with-nested-rule.bench.ts +1 -1
  68. package/src/benchmark/benches/lint-with-no-rules.bench.ts +1 -1
  69. package/src/benchmark/benches/lint-with-top-level-rule-report.bench.ts +1 -1
  70. package/src/benchmark/benches/lint-with-top-level-rule.bench.ts +1 -1
  71. package/src/benchmark/benches/recommended-oas3.bench.ts +3 -3
  72. package/src/benchmark/benches/resolve-with-no-external.bench.ts +1 -1
  73. package/src/benchmark/benchmark.js +9 -5
  74. package/src/benchmark/utils.ts +5 -5
  75. package/src/bundle.ts +18 -17
  76. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +1 -1
  77. package/src/config/__tests__/config-resolvers.test.ts +123 -121
  78. package/src/config/__tests__/config.test.ts +76 -76
  79. package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +4 -2
  80. package/src/config/__tests__/fixtures/resolve-config/plugin.js +4 -1
  81. package/src/config/__tests__/resolve-plugins.test.ts +3 -3
  82. package/src/config/__tests__/utils.test.ts +83 -0
  83. package/src/config/all.ts +3 -4
  84. package/src/config/builtIn.ts +5 -5
  85. package/src/config/config-resolvers.ts +122 -83
  86. package/src/config/config.ts +5 -5
  87. package/src/config/load.ts +6 -6
  88. package/src/config/minimal.ts +3 -3
  89. package/src/config/recommended.ts +3 -3
  90. package/src/config/rules.ts +6 -6
  91. package/src/config/types.ts +28 -19
  92. package/src/config/utils.ts +70 -50
  93. package/src/decorators/__tests__/filter-out.test.ts +8 -4
  94. package/src/decorators/__tests__/remove-x-internal.test.ts +5 -5
  95. package/src/decorators/common/filters/filter-helper.ts +1 -1
  96. package/src/decorators/common/info-description-override.ts +1 -1
  97. package/src/decorators/common/operation-description-override.ts +1 -1
  98. package/src/decorators/common/remove-x-internal.ts +4 -4
  99. package/src/decorators/common/tag-description-override.ts +1 -1
  100. package/src/format/codeframes.ts +4 -4
  101. package/src/format/format.ts +10 -10
  102. package/src/index.ts +2 -3
  103. package/src/js-yaml/index.ts +3 -8
  104. package/src/lint.ts +22 -18
  105. package/src/oas-types.ts +1 -6
  106. package/src/redocly/__tests__/redocly-client.test.ts +25 -19
  107. package/src/redocly/index.ts +6 -4
  108. package/src/redocly/registry-api.ts +6 -6
  109. package/src/ref-utils.ts +2 -2
  110. package/src/resolve.ts +7 -4
  111. package/src/rules/__tests__/no-unresolved-refs.test.ts +4 -4
  112. package/src/rules/__tests__/utils.test.ts +122 -0
  113. package/src/rules/ajv.ts +3 -4
  114. package/src/rules/common/__tests__/info-description.test.ts +3 -3
  115. package/src/rules/common/__tests__/info-license.test.ts +2 -2
  116. package/src/rules/common/__tests__/license-url.test.ts +2 -2
  117. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -1
  118. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +8 -8
  119. package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -1
  120. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +3 -3
  121. package/src/rules/common/__tests__/operation-2xx-response.test.ts +3 -3
  122. package/src/rules/common/__tests__/operation-4xx-response.test.ts +3 -3
  123. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +2 -2
  124. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -1
  125. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +4 -4
  126. package/src/rules/common/__tests__/operation-security-defined.test.ts +2 -2
  127. package/src/rules/common/__tests__/operation-singular-tag.test.ts +2 -2
  128. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +2 -2
  129. package/src/rules/common/__tests__/path-not-include-query.test.ts +2 -2
  130. package/src/rules/common/__tests__/path-params-defined.test.ts +3 -3
  131. package/src/rules/common/__tests__/paths-kebab-case.test.ts +15 -15
  132. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +8 -8
  133. package/src/rules/common/__tests__/spec.test.ts +2 -2
  134. package/src/rules/common/__tests__/tag-description.test.ts +2 -2
  135. package/src/rules/common/__tests__/tags-alphabetical.test.ts +2 -2
  136. package/src/rules/common/assertions/__tests__/asserts.test.ts +513 -130
  137. package/src/rules/common/assertions/index.ts +6 -6
  138. package/src/rules/common/info-license-url.ts +4 -9
  139. package/src/rules/common/info-license.ts +15 -0
  140. package/src/rules/common/no-ambiguous-paths.ts +1 -1
  141. package/src/rules/common/no-enum-type-mismatch.ts +12 -9
  142. package/src/rules/common/no-invalid-parameter-examples.ts +2 -2
  143. package/src/rules/common/no-invalid-schema-examples.ts +1 -1
  144. package/src/rules/common/operation-operationId.ts +1 -1
  145. package/src/rules/common/operation-parameters-unique.ts +2 -2
  146. package/src/rules/common/path-not-include-query.ts +1 -1
  147. package/src/rules/common/path-params-defined.ts +1 -1
  148. package/src/rules/common/paths-kebab-case.ts +4 -1
  149. package/src/rules/common/scalar-property-missing-example.ts +1 -1
  150. package/src/rules/common/spec.ts +10 -7
  151. package/src/rules/no-unresolved-refs.ts +1 -1
  152. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +3 -3
  153. package/src/rules/oas2/__tests__/spec/info.test.ts +12 -12
  154. package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
  155. package/src/rules/oas2/__tests__/spec/paths.test.ts +10 -10
  156. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +6 -2
  157. package/src/rules/oas2/__tests__/spec/utils.ts +6 -6
  158. package/src/rules/oas2/index.ts +3 -3
  159. package/src/rules/oas2/remove-unused-components.ts +13 -8
  160. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +3 -3
  161. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +2 -2
  162. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +8 -8
  163. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +2 -2
  164. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +3 -3
  165. package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -1
  166. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
  167. package/src/rules/oas3/__tests__/spec/info.test.ts +12 -12
  168. package/src/rules/oas3/__tests__/spec/operation.test.ts +8 -8
  169. package/src/rules/oas3/__tests__/spec/paths.test.ts +10 -10
  170. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +12 -12
  171. package/src/rules/oas3/__tests__/spec/servers.test.ts +15 -15
  172. package/src/rules/oas3/__tests__/spec/spec.test.ts +6 -6
  173. package/src/rules/oas3/__tests__/spec/utils.ts +6 -6
  174. package/src/rules/oas3/index.ts +3 -3
  175. package/src/rules/oas3/no-empty-servers.ts +1 -1
  176. package/src/rules/oas3/no-invalid-media-type-examples.ts +12 -4
  177. package/src/rules/oas3/no-servers-empty-enum.ts +9 -10
  178. package/src/rules/oas3/remove-unused-components.ts +18 -7
  179. package/src/rules/other/stats.ts +46 -17
  180. package/src/rules/utils.ts +5 -3
  181. package/src/types/index.ts +5 -5
  182. package/src/types/redocly-yaml.ts +8 -7
  183. package/src/typings/common.ts +9 -1
  184. package/src/typings/openapi.ts +1 -1
  185. package/src/visitors.ts +4 -4
  186. package/tsconfig.tsbuildinfo +1 -1
  187. package/lib/rules/common/license-url.d.ts +0 -2
  188. package/lib/rules/common/license-url.js +0 -12
  189. package/src/rules/common/license-url.ts +0 -10
package/README.md CHANGED
@@ -9,9 +9,9 @@ See https://github.com/Redocly/redocly-cli
9
9
  ```js
10
10
  import { formatProblems, lint, loadConfig } from '@redocly/openapi-core';
11
11
 
12
- const pathToEntryPoint = 'openapi.yaml';
12
+ const pathToApi = 'openapi.yaml';
13
13
  const config = loadConfig('optional/path/to/.redocly.yaml');
14
- const lintResults = await lint({ ref: pathToEntryPoint, config });
14
+ const lintResults = await lint({ ref: pathToApi, config });
15
15
  ```
16
16
 
17
17
  ### Bundle
@@ -19,7 +19,7 @@ const lintResults = await lint({ ref: pathToEntryPoint, config });
19
19
  ```js
20
20
  import { formatProblems, bundle, loadConfig } from '@redocly/openapi-core';
21
21
 
22
- const pathToEntryPoint = 'openapi.yaml';
22
+ const pathToApi = 'openapi.yaml';
23
23
  const config = loadConfig('optional/path/to/.redocly.yaml');
24
- const { bundle, problems } = await bundle({ ref: pathToEntryPoint, config });
24
+ const { bundle, problems } = await bundle({ ref: pathToApi, config });
25
25
  ```
@@ -1,7 +1,7 @@
1
1
  import * as path from 'path';
2
2
 
3
3
  import { Document, Source, NormalizedProblem, parseYaml, stringifyYaml } from '../src';
4
- import { LintConfig, resolveLint, resolvePlugins } from '../src/config';
4
+ import { StyleguideConfig, resolveStyleguideConfig, resolvePlugins } from '../src/config';
5
5
  import { Oas3RuleSet } from '../src/oas-types';
6
6
 
7
7
  import type { RuleConfig, Plugin, DecoratorConfig } from '../src/config';
@@ -63,7 +63,7 @@ export function makeConfigForRuleset(
63
63
  },
64
64
  ]);
65
65
 
66
- return new LintConfig({
66
+ return new StyleguideConfig({
67
67
  plugins,
68
68
  rules: rulesConf,
69
69
  });
@@ -74,9 +74,9 @@ export async function makeConfig(
74
74
  decorators?: Record<string, DecoratorConfig>,
75
75
  configPath?: string
76
76
  ) {
77
- return new LintConfig(
78
- await resolveLint({
79
- lintConfig: {
77
+ return new StyleguideConfig(
78
+ await resolveStyleguideConfig({
79
+ styleguideConfig: {
80
80
  plugins: [],
81
81
  extends: [],
82
82
  rules,
@@ -15,7 +15,7 @@ function measureAsync() {
15
15
  return lint_1.lintDocument({
16
16
  externalRefResolver: new resolve_1.BaseResolver(),
17
17
  document: rebillyDocument,
18
- config: new config_1.LintConfig(config_1.resolvePreset('recommended', [config_1.defaultPlugin])),
18
+ config: new config_1.StyleguideConfig(config_1.resolvePreset('recommended', [config_1.defaultPlugin])),
19
19
  });
20
20
  }
21
21
  exports.measureAsync = measureAsync;
@@ -1,6 +1,6 @@
1
1
  import { Document } from '../resolve';
2
2
  import { Oas3RuleSet } from '../oas-types';
3
- import { LintConfig } from '../config';
3
+ import { StyleguideConfig } from '../config';
4
4
  import type { Plugin } from '../config/types';
5
5
  export declare function parseYamlToDocument(body: string, absoluteRef?: string): Document;
6
- export declare function makeConfigForRuleset(rules: Oas3RuleSet, plugin?: Partial<Plugin>): LintConfig;
6
+ export declare function makeConfigForRuleset(rules: Oas3RuleSet, plugin?: Partial<Plugin>): StyleguideConfig;
@@ -25,7 +25,7 @@ function makeConfigForRuleset(rules, plugin) {
25
25
  if (rules) {
26
26
  extendConfigs.push({ rules });
27
27
  }
28
- const lint = config_1.mergeExtends(extendConfigs);
29
- return new config_1.LintConfig(lint);
28
+ const styleguide = config_1.mergeExtends(extendConfigs);
29
+ return new config_1.StyleguideConfig(styleguide);
30
30
  }
31
31
  exports.makeConfigForRuleset = makeConfigForRuleset;
package/lib/bundle.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BaseResolver, Document } from './resolve';
2
2
  import { Oas3Rule } from './visitors';
3
3
  import { NormalizedNodeType, NodeType } from './types';
4
4
  import { OasMajorVersion } from './oas-types';
5
- import type { Config, LintConfig } from './config';
5
+ import type { Config, StyleguideConfig } from './config';
6
6
  export declare type Oas3RuleSet = Record<string, Oas3Rule>;
7
7
  export declare enum OasVersion {
8
8
  Version2 = "oas2",
@@ -29,7 +29,7 @@ export declare function bundle(opts: {
29
29
  }>;
30
30
  export declare function bundleDocument(opts: {
31
31
  document: Document;
32
- config: LintConfig;
32
+ config: StyleguideConfig;
33
33
  customTypes?: Record<string, NodeType>;
34
34
  externalRefResolver: BaseResolver;
35
35
  dereference?: boolean;
package/lib/bundle.js CHANGED
@@ -42,7 +42,7 @@ function bundle(opts) {
42
42
  if (document instanceof Error) {
43
43
  throw document;
44
44
  }
45
- return bundleDocument(Object.assign(Object.assign({ document }, opts), { config: opts.config.lint, externalRefResolver }));
45
+ return bundleDocument(Object.assign(Object.assign({ document }, opts), { config: opts.config.styleguide, externalRefResolver }));
46
46
  });
47
47
  }
48
48
  exports.bundle = bundle;
@@ -71,7 +71,7 @@ function bundleDocument(opts) {
71
71
  ruleId: 'remove-unused-components',
72
72
  visitor: oasMajorVersion === oas_types_1.OasMajorVersion.Version2
73
73
  ? remove_unused_components_1.RemoveUnusedComponents({})
74
- : remove_unused_components_2.RemoveUnusedComponents({})
74
+ : remove_unused_components_2.RemoveUnusedComponents({}),
75
75
  });
76
76
  }
77
77
  const resolvedRefMap = yield resolve_1.resolveDocument({
@@ -1,3 +1,3 @@
1
- import type { PluginLintConfig } from "./types";
2
- declare const _default: PluginLintConfig;
1
+ import type { PluginStyleguideConfig } from './types';
2
+ declare const _default: PluginStyleguideConfig;
3
3
  export default _default;
package/lib/config/all.js CHANGED
@@ -19,7 +19,7 @@ exports.default = {
19
19
  'operation-description': 'error',
20
20
  'operation-2xx-response': 'error',
21
21
  'operation-4xx-response': 'error',
22
- 'assertions': 'error',
22
+ assertions: 'error',
23
23
  'operation-operationId': 'error',
24
24
  'operation-summary': 'error',
25
25
  'operation-operationId-unique': 'error',
@@ -1,3 +1,3 @@
1
- import type { LintRawConfig, Plugin } from './types';
2
- export declare const builtInConfigs: Record<string, LintRawConfig>;
1
+ import type { StyleguideRawConfig, Plugin } from './types';
2
+ export declare const builtInConfigs: Record<string, StyleguideRawConfig>;
3
3
  export declare const defaultPlugin: Plugin;
@@ -15,8 +15,8 @@ exports.builtInConfigs = {
15
15
  minimal: minimal_1.default,
16
16
  all: all_1.default,
17
17
  'redocly-registry': {
18
- decorators: { 'registry-dependencies': 'on' }
19
- }
18
+ decorators: { 'registry-dependencies': 'on' },
19
+ },
20
20
  };
21
21
  exports.defaultPlugin = {
22
22
  id: '',
@@ -1,5 +1,5 @@
1
1
  import { BaseResolver } from '../resolve';
2
- import type { LintRawConfig, Plugin, RawConfig, ResolvedApi, ResolvedLintConfig } from './types';
2
+ import type { StyleguideRawConfig, Plugin, RawConfig, ResolvedApi, ResolvedStyleguideConfig } from './types';
3
3
  import { Config } from './config';
4
4
  export declare function resolveConfig(rawConfig: RawConfig, configPath?: string): Promise<Config>;
5
5
  export declare function resolvePlugins(plugins: (string | Plugin)[] | null, configPath?: string): Plugin[];
@@ -8,9 +8,9 @@ export declare function resolveApis({ rawConfig, configPath, resolver, }: {
8
8
  configPath?: string;
9
9
  resolver?: BaseResolver;
10
10
  }): Promise<Record<string, ResolvedApi>>;
11
- export declare function resolveLint(lintOpts: {
12
- lintConfig?: LintRawConfig;
11
+ export declare function resolveStyleguideConfig(opts: {
12
+ styleguideConfig?: StyleguideRawConfig;
13
13
  configPath?: string;
14
14
  resolver?: BaseResolver;
15
- }, parentConfigPaths?: string[], extendPaths?: string[]): Promise<ResolvedLintConfig>;
16
- export declare function resolvePreset(presetName: string, plugins: Plugin[]): ResolvedLintConfig;
15
+ }, parentConfigPaths?: string[], extendPaths?: string[]): Promise<ResolvedStyleguideConfig>;
16
+ export declare function resolvePreset(presetName: string, plugins: Plugin[]): ResolvedStyleguideConfig;
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.resolvePreset = exports.resolveLint = exports.resolveApis = exports.resolvePlugins = exports.resolveConfig = void 0;
23
+ exports.resolvePreset = exports.resolveStyleguideConfig = exports.resolveApis = exports.resolvePlugins = exports.resolveConfig = void 0;
24
24
  const path = require("path");
25
25
  const colorette_1 = require("colorette");
26
26
  const ref_utils_1 = require("../ref-utils");
@@ -32,25 +32,25 @@ const config_1 = require("./config");
32
32
  function resolveConfig(rawConfig, configPath) {
33
33
  var _a, _b, _c, _d, _e;
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
- if ((_b = (_a = rawConfig.lint) === null || _a === void 0 ? void 0 : _a.extends) === null || _b === void 0 ? void 0 : _b.some(utils_2.isNotString)) {
35
+ if ((_b = (_a = rawConfig.styleguide) === null || _a === void 0 ? void 0 : _a.extends) === null || _b === void 0 ? void 0 : _b.some(utils_2.isNotString)) {
36
36
  throw new Error(`Error configuration format not detected in extends value must contain strings`);
37
37
  }
38
38
  const resolver = new resolve_1.BaseResolver(utils_1.getResolveConfig(rawConfig.resolve));
39
- const configExtends = (_d = (_c = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.lint) === null || _c === void 0 ? void 0 : _c.extends) !== null && _d !== void 0 ? _d : ['recommended'];
40
- const recommendedFallback = !((_e = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.lint) === null || _e === void 0 ? void 0 : _e.extends);
41
- const lintConfig = Object.assign(Object.assign({}, rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.lint), { extends: configExtends, recommendedFallback });
39
+ const configExtends = (_d = (_c = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.styleguide) === null || _c === void 0 ? void 0 : _c.extends) !== null && _d !== void 0 ? _d : ['recommended'];
40
+ const recommendedFallback = !((_e = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.styleguide) === null || _e === void 0 ? void 0 : _e.extends);
41
+ const styleguideConfig = Object.assign(Object.assign({}, rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.styleguide), { extends: configExtends, recommendedFallback });
42
42
  const apis = yield resolveApis({
43
- rawConfig: Object.assign(Object.assign({}, rawConfig), { lint: lintConfig }),
43
+ rawConfig: Object.assign(Object.assign({}, rawConfig), { styleguide: styleguideConfig }),
44
44
  configPath,
45
45
  resolver,
46
46
  });
47
- const lint = yield resolveLint({
48
- lintConfig,
47
+ const styleguide = yield resolveStyleguideConfig({
48
+ styleguideConfig,
49
49
  configPath,
50
50
  resolver,
51
51
  });
52
52
  return new config_1.Config(Object.assign(Object.assign({}, rawConfig), { apis,
53
- lint }), configPath);
53
+ styleguide }), configPath);
54
54
  });
55
55
  }
56
56
  exports.resolveConfig = resolveConfig;
@@ -123,36 +123,36 @@ exports.resolvePlugins = resolvePlugins;
123
123
  function resolveApis({ rawConfig, configPath = '', resolver, }) {
124
124
  var _a, _b;
125
125
  return __awaiter(this, void 0, void 0, function* () {
126
- const { apis = {}, lint: lintConfig = {} } = rawConfig;
126
+ const { apis = {}, styleguide: styleguideConfig = {} } = rawConfig;
127
127
  let resolvedApis = {};
128
128
  for (const [apiName, apiContent] of Object.entries(apis || {})) {
129
- if ((_b = (_a = apiContent.lint) === null || _a === void 0 ? void 0 : _a.extends) === null || _b === void 0 ? void 0 : _b.some(utils_2.isNotString)) {
129
+ if ((_b = (_a = apiContent.styleguide) === null || _a === void 0 ? void 0 : _a.extends) === null || _b === void 0 ? void 0 : _b.some(utils_2.isNotString)) {
130
130
  throw new Error(`Error configuration format not detected in extends value must contain strings`);
131
131
  }
132
- const rawLintConfig = getMergedLintRawConfig(lintConfig, apiContent.lint);
133
- const apiLint = yield resolveLint({
134
- lintConfig: rawLintConfig,
132
+ const rawStyleguideConfig = getMergedRawStyleguideConfig(styleguideConfig, apiContent.styleguide);
133
+ const resolvedApiConfig = yield resolveStyleguideConfig({
134
+ styleguideConfig: rawStyleguideConfig,
135
135
  configPath,
136
136
  resolver,
137
137
  });
138
- resolvedApis[apiName] = Object.assign(Object.assign({}, apiContent), { lint: apiLint });
138
+ resolvedApis[apiName] = Object.assign(Object.assign({}, apiContent), { styleguide: resolvedApiConfig });
139
139
  }
140
140
  return resolvedApis;
141
141
  });
142
142
  }
143
143
  exports.resolveApis = resolveApis;
144
- function resolveAndMergeNestedLint({ lintConfig, configPath = '', resolver = new resolve_1.BaseResolver(), }, parentConfigPaths = [], extendPaths = []) {
144
+ function resolveAndMergeNestedStyleguideConfig({ styleguideConfig, configPath = '', resolver = new resolve_1.BaseResolver(), }, parentConfigPaths = [], extendPaths = []) {
145
145
  var _a, _b, _c;
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
147
  if (parentConfigPaths.includes(configPath)) {
148
148
  throw new Error(`Circular dependency in config file: "${configPath}"`);
149
149
  }
150
- const plugins = utils_1.getUniquePlugins(resolvePlugins([...((lintConfig === null || lintConfig === void 0 ? void 0 : lintConfig.plugins) || []), builtIn_1.defaultPlugin], configPath));
151
- const pluginPaths = (_a = lintConfig === null || lintConfig === void 0 ? void 0 : lintConfig.plugins) === null || _a === void 0 ? void 0 : _a.filter(utils_2.isString).map((p) => path.resolve(path.dirname(configPath), p));
150
+ const plugins = utils_1.getUniquePlugins(resolvePlugins([...((styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.plugins) || []), builtIn_1.defaultPlugin], configPath));
151
+ const pluginPaths = (_a = styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.plugins) === null || _a === void 0 ? void 0 : _a.filter(utils_2.isString).map((p) => path.resolve(path.dirname(configPath), p));
152
152
  const resolvedConfigPath = ref_utils_1.isAbsoluteUrl(configPath)
153
153
  ? configPath
154
154
  : configPath && path.resolve(configPath);
155
- const extendConfigs = yield Promise.all(((_b = lintConfig === null || lintConfig === void 0 ? void 0 : lintConfig.extends) === null || _b === void 0 ? void 0 : _b.map((presetItem) => __awaiter(this, void 0, void 0, function* () {
155
+ const extendConfigs = yield Promise.all(((_b = styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.extends) === null || _b === void 0 ? void 0 : _b.map((presetItem) => __awaiter(this, void 0, void 0, function* () {
156
156
  if (!ref_utils_1.isAbsoluteUrl(presetItem) && !path.extname(presetItem)) {
157
157
  return resolvePreset(presetItem, plugins);
158
158
  }
@@ -161,27 +161,28 @@ function resolveAndMergeNestedLint({ lintConfig, configPath = '', resolver = new
161
161
  : ref_utils_1.isAbsoluteUrl(configPath)
162
162
  ? new URL(presetItem, configPath).href
163
163
  : path.resolve(path.dirname(configPath), presetItem);
164
- const extendedLintConfig = yield loadExtendLintConfig(pathItem, resolver);
165
- return yield resolveAndMergeNestedLint({
166
- lintConfig: extendedLintConfig,
164
+ const extendedStyleguideConfig = yield loadExtendStyleguideConfig(pathItem, resolver);
165
+ return yield resolveAndMergeNestedStyleguideConfig({
166
+ styleguideConfig: extendedStyleguideConfig,
167
167
  configPath: pathItem,
168
168
  resolver: resolver,
169
169
  }, [...parentConfigPaths, resolvedConfigPath], extendPaths);
170
170
  }))) || []);
171
171
  const _d = utils_1.mergeExtends([
172
172
  ...extendConfigs,
173
- Object.assign(Object.assign({}, lintConfig), { plugins, extends: undefined, extendPaths: [...parentConfigPaths, resolvedConfigPath], pluginPaths }),
174
- ]), { plugins: mergedPlugins = [] } = _d, lint = __rest(_d, ["plugins"]);
175
- return Object.assign(Object.assign({}, lint), { extendPaths: (_c = lint.extendPaths) === null || _c === void 0 ? void 0 : _c.filter((path) => path && !ref_utils_1.isAbsoluteUrl(path)), plugins: utils_1.getUniquePlugins(mergedPlugins), recommendedFallback: lintConfig === null || lintConfig === void 0 ? void 0 : lintConfig.recommendedFallback, doNotResolveExamples: lintConfig === null || lintConfig === void 0 ? void 0 : lintConfig.doNotResolveExamples });
173
+ Object.assign(Object.assign({}, styleguideConfig), { plugins, extends: undefined, extendPaths: [...parentConfigPaths, resolvedConfigPath], pluginPaths }),
174
+ ]), { plugins: mergedPlugins = [] } = _d, styleguide = __rest(_d, ["plugins"]);
175
+ return Object.assign(Object.assign({}, styleguide), { extendPaths: (_c = styleguide.extendPaths) === null || _c === void 0 ? void 0 : _c.filter((path) => path && !ref_utils_1.isAbsoluteUrl(path)), plugins: utils_1.getUniquePlugins(mergedPlugins), recommendedFallback: styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.recommendedFallback, doNotResolveExamples: styleguideConfig === null || styleguideConfig === void 0 ? void 0 : styleguideConfig.doNotResolveExamples });
176
176
  });
177
177
  }
178
- function resolveLint(lintOpts, parentConfigPaths = [], extendPaths = []) {
178
+ function resolveStyleguideConfig(opts, parentConfigPaths = [], extendPaths = []) {
179
179
  return __awaiter(this, void 0, void 0, function* () {
180
- const resolvedLint = yield resolveAndMergeNestedLint(lintOpts, parentConfigPaths, extendPaths);
181
- return Object.assign(Object.assign({}, resolvedLint), { rules: resolvedLint.rules && groupLintAssertionRules(resolvedLint.rules) });
180
+ const resolvedStyleguideConfig = yield resolveAndMergeNestedStyleguideConfig(opts, parentConfigPaths, extendPaths);
181
+ return Object.assign(Object.assign({}, resolvedStyleguideConfig), { rules: resolvedStyleguideConfig.rules &&
182
+ groupStyleguideAssertionRules(resolvedStyleguideConfig.rules) });
182
183
  });
183
184
  }
184
- exports.resolveLint = resolveLint;
185
+ exports.resolveStyleguideConfig = resolveStyleguideConfig;
185
186
  function resolvePreset(presetName, plugins) {
186
187
  var _a;
187
188
  const { pluginId, configName } = utils_1.parsePresetName(presetName);
@@ -198,26 +199,28 @@ function resolvePreset(presetName, plugins) {
198
199
  return preset;
199
200
  }
200
201
  exports.resolvePreset = resolvePreset;
201
- function loadExtendLintConfig(filePath, resolver) {
202
+ function loadExtendStyleguideConfig(filePath, resolver) {
202
203
  return __awaiter(this, void 0, void 0, function* () {
203
204
  try {
204
205
  const fileSource = yield resolver.loadExternalRef(filePath);
205
206
  const rawConfig = utils_1.transformConfig(utils_2.parseYaml(fileSource.body));
206
- if (!rawConfig.lint) {
207
- throw new Error(`Lint configuration format not detected: "${filePath}"`);
207
+ if (!rawConfig.styleguide) {
208
+ throw new Error(`Styleguide configuration format not detected: "${filePath}"`);
208
209
  }
209
- return rawConfig.lint;
210
+ return rawConfig.styleguide;
210
211
  }
211
212
  catch (error) {
212
213
  throw new Error(`Failed to load "${filePath}": ${error.message}`);
213
214
  }
214
215
  });
215
216
  }
216
- function getMergedLintRawConfig(configLint, apiLint) {
217
- const resultLint = Object.assign(Object.assign(Object.assign({}, configLint), apiLint), { rules: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.rules), apiLint === null || apiLint === void 0 ? void 0 : apiLint.rules), oas2Rules: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas2Rules), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas2Rules), oas3_0Rules: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas3_0Rules), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas3_0Rules), oas3_1Rules: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas3_1Rules), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas3_1Rules), preprocessors: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.preprocessors), apiLint === null || apiLint === void 0 ? void 0 : apiLint.preprocessors), oas2Preprocessors: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas2Preprocessors), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas2Preprocessors), oas3_0Preprocessors: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas3_0Preprocessors), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas3_0Preprocessors), oas3_1Preprocessors: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas3_1Preprocessors), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas3_1Preprocessors), decorators: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.decorators), apiLint === null || apiLint === void 0 ? void 0 : apiLint.decorators), oas2Decorators: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas2Decorators), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas2Decorators), oas3_0Decorators: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas3_0Decorators), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas3_0Decorators), oas3_1Decorators: Object.assign(Object.assign({}, configLint === null || configLint === void 0 ? void 0 : configLint.oas3_1Decorators), apiLint === null || apiLint === void 0 ? void 0 : apiLint.oas3_1Decorators), recommendedFallback: (apiLint === null || apiLint === void 0 ? void 0 : apiLint.extends) ? false : configLint.recommendedFallback });
217
+ function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig) {
218
+ const resultLint = Object.assign(Object.assign(Object.assign({}, rootStyleguideConfig), apiStyleguideConfig), { rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.rules), oas2Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Rules), oas3_0Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Rules), oas3_1Rules: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Rules), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Rules), preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.preprocessors), oas2Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Preprocessors), oas3_0Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Preprocessors), oas3_1Preprocessors: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Preprocessors), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Preprocessors), decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.decorators), oas2Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas2Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas2Decorators), oas3_0Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_0Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_0Decorators), oas3_1Decorators: Object.assign(Object.assign({}, rootStyleguideConfig === null || rootStyleguideConfig === void 0 ? void 0 : rootStyleguideConfig.oas3_1Decorators), apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.oas3_1Decorators), recommendedFallback: (apiStyleguideConfig === null || apiStyleguideConfig === void 0 ? void 0 : apiStyleguideConfig.extends)
219
+ ? false
220
+ : rootStyleguideConfig.recommendedFallback });
218
221
  return resultLint;
219
222
  }
220
- function groupLintAssertionRules(rules) {
223
+ function groupStyleguideAssertionRules(rules) {
221
224
  if (!rules) {
222
225
  return rules;
223
226
  }
@@ -2,7 +2,7 @@
2
2
  import { NormalizedProblem } from '../walk';
3
3
  import { OasVersion, OasMajorVersion, Oas2RuleSet, Oas3RuleSet } from '../oas-types';
4
4
  import type { NodeType } from '../types';
5
- import type { DecoratorConfig, Plugin, PreprocessorConfig, Region, ResolveConfig, ResolvedApi, ResolvedConfig, ResolvedLintConfig, RuleConfig } from './types';
5
+ import type { DecoratorConfig, Plugin, PreprocessorConfig, Region, ResolveConfig, ResolvedApi, ResolvedConfig, ResolvedStyleguideConfig, RuleConfig } from './types';
6
6
  export declare const env: NodeJS.ProcessEnv;
7
7
  export declare const IGNORE_FILE = ".redocly.lint-ignore.yaml";
8
8
  export declare const DEFAULT_REGION = "us";
@@ -11,8 +11,8 @@ export declare const DOMAINS: {
11
11
  eu: string;
12
12
  };
13
13
  export declare const AVAILABLE_REGIONS: Region[];
14
- export declare class LintConfig {
15
- rawConfig: ResolvedLintConfig;
14
+ export declare class StyleguideConfig {
15
+ rawConfig: ResolvedStyleguideConfig;
16
16
  configFile?: string | undefined;
17
17
  plugins: Plugin[];
18
18
  ignore: Record<string, Record<string, Set<string>>>;
@@ -25,7 +25,7 @@ export declare class LintConfig {
25
25
  recommendedFallback: boolean;
26
26
  extendPaths: string[];
27
27
  pluginPaths: string[];
28
- constructor(rawConfig: ResolvedLintConfig, configFile?: string | undefined);
28
+ constructor(rawConfig: ResolvedStyleguideConfig, configFile?: string | undefined);
29
29
  resolveIgnore(ignoreFile?: string): void;
30
30
  saveIgnore(): void;
31
31
  addIgnore(problem: NormalizedProblem): void;
@@ -54,7 +54,7 @@ export declare class Config {
54
54
  rawConfig: ResolvedConfig;
55
55
  configFile?: string | undefined;
56
56
  apis: Record<string, ResolvedApi>;
57
- lint: LintConfig;
57
+ styleguide: StyleguideConfig;
58
58
  resolve: ResolveConfig;
59
59
  licenseKey?: string;
60
60
  region?: Region;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Config = exports.LintConfig = exports.AVAILABLE_REGIONS = exports.DOMAINS = exports.DEFAULT_REGION = exports.IGNORE_FILE = exports.env = void 0;
3
+ exports.Config = exports.StyleguideConfig = exports.AVAILABLE_REGIONS = exports.DOMAINS = exports.DEFAULT_REGION = exports.IGNORE_FILE = exports.env = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
6
  const js_yaml_1 = require("../js-yaml");
@@ -40,7 +40,7 @@ function getIgnoreFilePath(configFile) {
40
40
  }
41
41
  exports.DOMAINS = getDomains();
42
42
  exports.AVAILABLE_REGIONS = Object.keys(exports.DOMAINS);
43
- class LintConfig {
43
+ class StyleguideConfig {
44
44
  constructor(rawConfig, configFile) {
45
45
  this.rawConfig = rawConfig;
46
46
  this.configFile = configFile;
@@ -234,13 +234,13 @@ class LintConfig {
234
234
  }
235
235
  }
236
236
  }
237
- exports.LintConfig = LintConfig;
237
+ exports.StyleguideConfig = StyleguideConfig;
238
238
  class Config {
239
239
  constructor(rawConfig, configFile) {
240
240
  this.rawConfig = rawConfig;
241
241
  this.configFile = configFile;
242
242
  this.apis = rawConfig.apis || {};
243
- this.lint = new LintConfig(rawConfig.lint || {}, configFile);
243
+ this.styleguide = new StyleguideConfig(rawConfig.styleguide || {}, configFile);
244
244
  this['features.openapi'] = rawConfig['features.openapi'] || {};
245
245
  this['features.mockServer'] = rawConfig['features.mockServer'] || {};
246
246
  this.resolve = utils_2.getResolveConfig(rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.resolve);
@@ -21,12 +21,12 @@ function addConfigMetadata({ rawConfig, customExtends, configPath, }) {
21
21
  var _a;
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
23
  if (customExtends !== undefined) {
24
- rawConfig.lint = rawConfig.lint || {};
25
- rawConfig.lint.extends = customExtends;
24
+ rawConfig.styleguide = rawConfig.styleguide || {};
25
+ rawConfig.styleguide.extends = customExtends;
26
26
  }
27
27
  else if (utils_1.isEmptyObject(rawConfig)) {
28
28
  // TODO: check if we can add recommended here. add message here?
29
- // rawConfig.lint = { extends: ['recommended'], recommendedFallback: true };
29
+ // rawConfig.styleguide = { extends: ['recommended'], recommendedFallback: true };
30
30
  }
31
31
  const redoclyClient = new redocly_1.RedoclyClient();
32
32
  const tokens = yield redoclyClient.getTokens();
@@ -94,7 +94,7 @@ function getConfig(configPath = findConfig()) {
94
94
  if (!configPath || !utils_1.doesYamlFileExist(configPath))
95
95
  return {};
96
96
  try {
97
- const rawConfig = ((yield utils_1.loadYaml(configPath)) || {});
97
+ const rawConfig = (yield utils_1.loadYaml(configPath)) || {};
98
98
  return utils_2.transformConfig(rawConfig);
99
99
  }
100
100
  catch (e) {
@@ -1,3 +1,3 @@
1
- import type { PluginLintConfig } from './types';
2
- declare const _default: PluginLintConfig;
1
+ import type { PluginStyleguideConfig } from './types';
2
+ declare const _default: PluginStyleguideConfig;
3
3
  export default _default;
@@ -18,7 +18,7 @@ exports.default = {
18
18
  'operation-description': 'off',
19
19
  'operation-2xx-response': 'warn',
20
20
  'operation-4xx-response': 'off',
21
- 'assertions': 'warn',
21
+ assertions: 'warn',
22
22
  'operation-operationId': 'warn',
23
23
  'operation-summary': 'warn',
24
24
  'operation-operationId-unique': 'warn',
@@ -1,3 +1,3 @@
1
- import type { PluginLintConfig } from './types';
2
- declare const _default: PluginLintConfig;
1
+ import type { PluginStyleguideConfig } from './types';
2
+ declare const _default: PluginStyleguideConfig;
3
3
  export default _default;
@@ -17,7 +17,7 @@ exports.default = {
17
17
  'path-parameters-defined': 'error',
18
18
  'operation-description': 'off',
19
19
  'operation-2xx-response': 'warn',
20
- 'assertions': 'warn',
20
+ assertions: 'warn',
21
21
  'operation-4xx-response': 'warn',
22
22
  'operation-operationId': 'warn',
23
23
  'operation-summary': 'error',
@@ -1,6 +1,6 @@
1
1
  import { RuleSet, OasVersion } from '../oas-types';
2
- import { LintConfig } from './config';
3
- export declare function initRules<T extends Function, P extends RuleSet<T>>(rules: P[], config: LintConfig, type: 'rules' | 'preprocessors' | 'decorators', oasVersion: OasVersion): {
2
+ import { StyleguideConfig } from './config';
3
+ export declare function initRules<T extends Function, P extends RuleSet<T>>(rules: P[], config: StyleguideConfig, type: 'rules' | 'preprocessors' | 'decorators', oasVersion: OasVersion): {
4
4
  severity: import("./types").RuleSeverity;
5
5
  ruleId: string;
6
6
  visitor: any;
@@ -28,7 +28,7 @@ function initRules(rules, config, type, oasVersion) {
28
28
  visitor: visitors, // note: actually it is only one visitor object
29
29
  };
30
30
  }))
31
- .flatMap(visitor => visitor)
31
+ .flatMap((visitor) => visitor)
32
32
  .filter(utils_1.notUndefined);
33
33
  }
34
34
  exports.initRules = initRules;
@@ -10,7 +10,7 @@ export declare type PreprocessorConfig = PreprocessorSeverity | ({
10
10
  severity?: ProblemSeverity;
11
11
  } & Record<string, any>);
12
12
  export declare type DecoratorConfig = PreprocessorConfig;
13
- export declare type LintRawConfig = {
13
+ export declare type StyleguideRawConfig = {
14
14
  plugins?: (string | Plugin)[];
15
15
  extends?: string[];
16
16
  doNotResolveExamples?: boolean;
@@ -28,7 +28,8 @@ export declare type LintRawConfig = {
28
28
  oas3_0Decorators?: Record<string, DecoratorConfig>;
29
29
  oas3_1Decorators?: Record<string, DecoratorConfig>;
30
30
  };
31
- export declare type ResolvedLintConfig = PluginLintConfig & {
31
+ export declare type ApiStyleguideRawConfig = Omit<StyleguideRawConfig, 'plugins'>;
32
+ export declare type ResolvedStyleguideConfig = PluginStyleguideConfig & {
32
33
  plugins?: Plugin[];
33
34
  recommendedFallback?: boolean;
34
35
  extends?: void | never;
@@ -51,13 +52,13 @@ export declare type CustomRulesConfig = {
51
52
  };
52
53
  export declare type Plugin = {
53
54
  id: string;
54
- configs?: Record<string, PluginLintConfig>;
55
+ configs?: Record<string, PluginStyleguideConfig>;
55
56
  rules?: CustomRulesConfig;
56
57
  preprocessors?: PreprocessorsConfig;
57
58
  decorators?: DecoratorsConfig;
58
59
  typeExtension?: TypeExtensionsConfig;
59
60
  };
60
- export declare type PluginLintConfig = Omit<LintRawConfig, 'plugins' | 'extends'>;
61
+ export declare type PluginStyleguideConfig = Omit<StyleguideRawConfig, 'plugins' | 'extends'>;
61
62
  export declare type ResolveHeader = {
62
63
  name: string;
63
64
  envVariable?: undefined;
@@ -83,33 +84,36 @@ export declare type Region = 'us' | 'eu';
83
84
  export declare type AccessTokens = {
84
85
  [region in Region]?: string;
85
86
  };
86
- export declare type DeprecatedRawConfig = {
87
+ export declare type DeprecatedInRawConfig = {
87
88
  apiDefinitions?: Record<string, string>;
88
- lint?: LintRawConfig;
89
- resolve?: RawResolveConfig;
90
- region?: Region;
89
+ lint?: StyleguideRawConfig;
91
90
  referenceDocs?: Record<string, any>;
91
+ apis?: Record<string, Api & DeprecatedInApi>;
92
92
  };
93
93
  export declare type Api = {
94
94
  root: string;
95
- lint?: Omit<LintRawConfig, 'plugins'>;
96
- 'features.openapi'?: Record<string, any>;
97
- 'features.mockServer'?: Record<string, any>;
95
+ styleguide?: ApiStyleguideRawConfig;
96
+ } & FeaturesConfig;
97
+ export declare type DeprecatedInApi = {
98
+ lint?: ApiStyleguideRawConfig;
98
99
  };
99
- export declare type ResolvedApi = Omit<Api, 'lint'> & {
100
- lint: Omit<ResolvedLintConfig, 'plugins'>;
100
+ export declare type ResolvedApi = Omit<Api, 'styleguide'> & {
101
+ styleguide: ResolvedStyleguideConfig;
101
102
  };
102
103
  export declare type RawConfig = {
103
104
  apis?: Record<string, Api>;
104
- lint?: LintRawConfig;
105
+ styleguide?: StyleguideRawConfig;
105
106
  resolve?: RawResolveConfig;
106
107
  region?: Region;
107
- 'features.openapi'?: Record<string, any>;
108
- 'features.mockServer'?: Record<string, any>;
109
108
  organization?: string;
110
- };
111
- export declare type ResolvedConfig = Omit<RawConfig, 'lint' | 'apis'> & {
112
- lint: ResolvedLintConfig;
109
+ } & FeaturesConfig;
110
+ export declare type ResolvedConfig = Omit<RawConfig, 'apis' | 'styleguide'> & {
113
111
  apis: Record<string, ResolvedApi>;
112
+ styleguide: ResolvedStyleguideConfig;
113
+ };
114
+ declare type FeaturesConfig = {
115
+ 'features.openapi'?: Record<string, any>;
116
+ 'features.mockServer'?: Record<string, any>;
114
117
  };
115
118
  export declare type RulesFields = 'rules' | 'oas2Rules' | 'oas3_0Rules' | 'oas3_1Rules' | 'preprocessors' | 'oas2Preprocessors' | 'oas3_0Preprocessors' | 'oas3_1Preprocessors' | 'decorators' | 'oas2Decorators' | 'oas3_0Decorators' | 'oas3_1Decorators';
119
+ export {};
@@ -1,13 +1,13 @@
1
1
  import { Config } from './config';
2
- import type { Api, DeprecatedRawConfig, Plugin, RawConfig, RawResolveConfig, ResolveConfig, ResolvedLintConfig, RulesFields } from './types';
2
+ import type { Api, DeprecatedInRawConfig, Plugin, RawConfig, RawResolveConfig, ResolveConfig, ResolvedStyleguideConfig, RulesFields } from './types';
3
3
  export declare function parsePresetName(presetName: string): {
4
4
  pluginId: string;
5
5
  configName: string;
6
6
  };
7
- export declare function transformApiDefinitionsToApis(apiDefinitions?: Record<string, string>): Record<string, Api>;
7
+ export declare function transformApiDefinitionsToApis(apiDefinitions?: DeprecatedInRawConfig['apiDefinitions']): Record<string, Api> | undefined;
8
8
  export declare function prefixRules<T extends Record<string, any>>(rules: T, prefix: string): any;
9
- export declare function mergeExtends(rulesConfList: ResolvedLintConfig[]): Omit<ResolvedLintConfig, RulesFields> & Required<Pick<ResolvedLintConfig, RulesFields>>;
10
- export declare function getMergedConfig(config: Config, entrypointAlias?: string): Config;
11
- export declare function transformConfig(rawConfig: DeprecatedRawConfig | RawConfig): RawConfig;
9
+ export declare function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]): Omit<ResolvedStyleguideConfig, RulesFields> & Required<Pick<ResolvedStyleguideConfig, RulesFields>>;
10
+ export declare function getMergedConfig(config: Config, apiName?: string): Config;
11
+ export declare function transformConfig(rawConfig: DeprecatedInRawConfig & RawConfig): RawConfig;
12
12
  export declare function getResolveConfig(resolve?: RawResolveConfig): ResolveConfig;
13
13
  export declare function getUniquePlugins(plugins: Plugin[]): Plugin[];