@redocly/openapi-core 1.2.1 → 1.4.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.
Files changed (192) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/benchmark/benches/lint-with-many-rules.bench.js +4 -4
  3. package/lib/benchmark/benches/lint-with-nested-rule.bench.js +4 -4
  4. package/lib/benchmark/benches/lint-with-no-rules.bench.js +4 -4
  5. package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +4 -4
  6. package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +4 -4
  7. package/lib/benchmark/benches/recommended-oas3.bench.js +4 -4
  8. package/lib/benchmark/benches/resolve-with-no-external.bench.js +3 -3
  9. package/lib/benchmark/utils.js +3 -3
  10. package/lib/bundle.d.ts +4 -4
  11. package/lib/bundle.js +23 -23
  12. package/lib/config/all.d.ts +2 -2
  13. package/lib/config/all.js +44 -8
  14. package/lib/config/builtIn.js +2 -0
  15. package/lib/config/config-resolvers.js +25 -25
  16. package/lib/config/config.js +9 -9
  17. package/lib/config/index.js +5 -1
  18. package/lib/config/load.d.ts +1 -1
  19. package/lib/config/load.js +9 -6
  20. package/lib/config/minimal.d.ts +2 -2
  21. package/lib/config/minimal.js +34 -3
  22. package/lib/config/recommended-strict.d.ts +3 -0
  23. package/lib/config/recommended-strict.js +92 -0
  24. package/lib/config/recommended.d.ts +2 -2
  25. package/lib/config/recommended.js +34 -3
  26. package/lib/config/rules.d.ts +1 -1
  27. package/lib/config/types.d.ts +47 -46
  28. package/lib/config/types.js +2 -2
  29. package/lib/config/utils.d.ts +2 -0
  30. package/lib/config/utils.js +30 -15
  31. package/lib/decorators/common/filters/filter-helper.js +4 -4
  32. package/lib/decorators/common/filters/filter-in.js +2 -2
  33. package/lib/decorators/common/filters/filter-out.js +2 -2
  34. package/lib/decorators/common/info-description-override.js +1 -1
  35. package/lib/decorators/common/media-type-examples-override.js +3 -3
  36. package/lib/decorators/common/operation-description-override.js +1 -1
  37. package/lib/decorators/common/registry-dependencies.js +1 -1
  38. package/lib/decorators/common/remove-x-internal.js +4 -4
  39. package/lib/decorators/common/tag-description-override.js +1 -1
  40. package/lib/format/codeframes.d.ts +6 -6
  41. package/lib/format/format.d.ts +2 -2
  42. package/lib/format/format.js +12 -12
  43. package/lib/js-yaml/index.d.ts +2 -2
  44. package/lib/js-yaml/index.js +2 -2
  45. package/lib/lint.js +18 -18
  46. package/lib/oas-types.d.ts +12 -10
  47. package/lib/oas-types.js +2 -2
  48. package/lib/redocly/index.js +10 -10
  49. package/lib/redocly/registry-api.js +2 -2
  50. package/lib/resolve.d.ts +4 -4
  51. package/lib/resolve.js +18 -18
  52. package/lib/rules/ajv.js +1 -1
  53. package/lib/rules/async2/index.d.ts +2 -11
  54. package/lib/rules/common/assertions/asserts.d.ts +3 -3
  55. package/lib/rules/common/assertions/asserts.js +21 -21
  56. package/lib/rules/common/assertions/index.d.ts +4 -4
  57. package/lib/rules/common/assertions/index.js +3 -3
  58. package/lib/rules/common/assertions/utils.d.ts +4 -4
  59. package/lib/rules/common/assertions/utils.js +3 -3
  60. package/lib/rules/common/info-contact.js +1 -1
  61. package/lib/rules/common/info-license-url.js +1 -1
  62. package/lib/rules/common/info-license.js +1 -1
  63. package/lib/rules/common/no-enum-type-mismatch.js +3 -3
  64. package/lib/rules/common/no-http-verbs-in-paths.js +2 -2
  65. package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
  66. package/lib/rules/common/no-invalid-schema-examples.js +3 -3
  67. package/lib/rules/common/operation-2xx-response.js +2 -2
  68. package/lib/rules/common/operation-4xx-response.js +2 -2
  69. package/lib/rules/common/operation-description.js +1 -1
  70. package/lib/rules/common/operation-operationId.js +1 -1
  71. package/lib/rules/common/operation-summary.js +1 -1
  72. package/lib/rules/common/path-segment-plural.js +1 -1
  73. package/lib/rules/common/response-contains-header.js +2 -2
  74. package/lib/rules/common/spec-strict-refs.js +1 -1
  75. package/lib/rules/common/spec.js +11 -11
  76. package/lib/rules/common/tag-description.js +1 -1
  77. package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -1
  78. package/lib/rules/oas2/index.d.ts +2 -46
  79. package/lib/rules/oas2/remove-unused-components.js +1 -1
  80. package/lib/rules/oas2/request-mime-type.js +2 -2
  81. package/lib/rules/oas2/response-contains-property.js +2 -2
  82. package/lib/rules/oas2/response-mime-type.js +2 -2
  83. package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -1
  84. package/lib/rules/oas3/index.d.ts +1 -1
  85. package/lib/rules/oas3/index.js +1 -1
  86. package/lib/rules/oas3/no-invalid-media-type-examples.js +3 -3
  87. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
  88. package/lib/rules/oas3/remove-unused-components.js +2 -2
  89. package/lib/rules/oas3/request-mime-type.js +3 -3
  90. package/lib/rules/oas3/response-contains-property.js +2 -2
  91. package/lib/rules/oas3/response-mime-type.js +3 -3
  92. package/lib/rules/utils.js +3 -3
  93. package/lib/types/asyncapi.js +21 -21
  94. package/lib/types/index.d.ts +8 -8
  95. package/lib/types/oas2.js +14 -14
  96. package/lib/types/oas3.js +27 -27
  97. package/lib/types/oas3_1.js +6 -6
  98. package/lib/types/redocly-yaml.d.ts +11 -0
  99. package/lib/types/redocly-yaml.js +71 -53
  100. package/lib/types/theme-config.js +1 -1
  101. package/lib/typings/common.d.ts +2 -2
  102. package/lib/typings/openapi.d.ts +6 -6
  103. package/lib/typings/swagger.d.ts +3 -3
  104. package/lib/utils.d.ts +5 -5
  105. package/lib/utils.js +3 -3
  106. package/lib/visitors.d.ts +40 -40
  107. package/lib/walk.d.ts +14 -15
  108. package/lib/walk.js +11 -11
  109. package/package.json +2 -2
  110. package/src/__tests__/lint.test.ts +40 -40
  111. package/src/__tests__/normalizeVisitors.test.ts +23 -5
  112. package/src/__tests__/ref-utils.test.ts +7 -7
  113. package/src/__tests__/resolve-http.test.ts +10 -10
  114. package/src/__tests__/resolve.test.ts +39 -39
  115. package/src/__tests__/walk.test.ts +48 -48
  116. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +95 -32
  117. package/src/config/__tests__/__snapshots__/config.test.ts.snap +81 -81
  118. package/src/config/__tests__/config-resolvers.test.ts +30 -1
  119. package/src/config/__tests__/config.test.ts +88 -88
  120. package/src/config/__tests__/load.test.ts +12 -8
  121. package/src/config/__tests__/utils.test.ts +18 -18
  122. package/src/config/all.ts +46 -9
  123. package/src/config/builtIn.ts +2 -0
  124. package/src/config/load.ts +4 -1
  125. package/src/config/minimal.ts +36 -4
  126. package/src/config/recommended-strict.ts +93 -0
  127. package/src/config/recommended.ts +36 -4
  128. package/src/config/types.ts +22 -8
  129. package/src/config/utils.ts +17 -0
  130. package/src/decorators/common/media-type-examples-override.ts +2 -2
  131. package/src/lint.ts +3 -3
  132. package/src/oas-types.ts +26 -3
  133. package/src/rules/__tests__/no-unresolved-refs.test.ts +26 -26
  134. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +12 -12
  135. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +7 -7
  136. package/src/rules/async2/index.ts +2 -1
  137. package/src/rules/common/__tests__/info-license.test.ts +6 -6
  138. package/src/rules/common/__tests__/license-url.test.ts +6 -6
  139. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +13 -13
  140. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +18 -18
  141. package/src/rules/common/__tests__/no-identical-paths.test.ts +5 -5
  142. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +12 -12
  143. package/src/rules/common/__tests__/operation-2xx-response.test.ts +18 -18
  144. package/src/rules/common/__tests__/operation-4xx-response.test.ts +23 -23
  145. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +6 -6
  146. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +5 -5
  147. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +16 -16
  148. package/src/rules/common/__tests__/operation-singular-tag.test.ts +6 -6
  149. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +10 -10
  150. package/src/rules/common/__tests__/path-not-include-query.test.ts +6 -6
  151. package/src/rules/common/__tests__/path-params-defined.test.ts +21 -21
  152. package/src/rules/common/__tests__/paths-kebab-case.test.ts +11 -11
  153. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +18 -18
  154. package/src/rules/common/__tests__/security-defined.test.ts +21 -21
  155. package/src/rules/common/__tests__/spec-strict-refs.test.ts +9 -9
  156. package/src/rules/common/__tests__/spec.test.ts +102 -102
  157. package/src/rules/common/__tests__/tag-description.test.ts +6 -6
  158. package/src/rules/common/__tests__/tags-alphabetical.test.ts +12 -12
  159. package/src/rules/common/assertions/__tests__/index.test.ts +15 -15
  160. package/src/rules/common/assertions/__tests__/utils.test.ts +9 -9
  161. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  162. package/src/rules/oas2/__tests__/response-contains-header.test.ts +13 -13
  163. package/src/rules/oas2/__tests__/response-contains-property.test.ts +8 -8
  164. package/src/rules/oas2/__tests__/spec/info.test.ts +21 -21
  165. package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
  166. package/src/rules/oas2/__tests__/spec/paths.test.ts +12 -12
  167. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
  168. package/src/rules/oas2/index.ts +3 -1
  169. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  170. package/src/rules/oas3/__tests__/component-name-unique.test.ts +186 -186
  171. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +18 -18
  172. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +6 -6
  173. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +36 -36
  174. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +11 -11
  175. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +7 -7
  176. package/src/rules/oas3/__tests__/no-unused-components.test.ts +31 -31
  177. package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +15 -15
  178. package/src/rules/oas3/__tests__/response-contains-header.test.ts +26 -26
  179. package/src/rules/oas3/__tests__/response-contains-property.test.ts +27 -27
  180. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
  181. package/src/rules/oas3/__tests__/spec/info.test.ts +21 -21
  182. package/src/rules/oas3/__tests__/spec/operation.test.ts +10 -10
  183. package/src/rules/oas3/__tests__/spec/paths.test.ts +13 -13
  184. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +2 -2
  185. package/src/rules/oas3/__tests__/spec/servers.test.ts +25 -25
  186. package/src/rules/oas3/__tests__/spec/spec.test.ts +56 -56
  187. package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +28 -28
  188. package/src/rules/oas3/index.ts +3 -3
  189. package/src/types/redocly-yaml.ts +75 -40
  190. package/src/visitors.ts +3 -3
  191. package/src/walk.ts +23 -10
  192. package/tsconfig.tsbuildinfo +1 -1
@@ -2,18 +2,18 @@ import { Asserts } from './asserts';
2
2
  import type { AssertionContext, AssertResult } from '../../../config';
3
3
  import type { Assertion, AssertionDefinition } from '.';
4
4
  import type { Oas2Visitor, Oas3Visitor, VisitFunction } from '../../../visitors';
5
- export declare type OrderDirection = 'asc' | 'desc';
6
- export declare type OrderOptions = {
5
+ export type OrderDirection = 'asc' | 'desc';
6
+ export type OrderOptions = {
7
7
  direction: OrderDirection;
8
8
  property: string;
9
9
  };
10
- export declare type AssertToApply = {
10
+ export type AssertToApply = {
11
11
  name: keyof Asserts;
12
12
  conditions: any;
13
13
  runsOnKeys: boolean;
14
14
  runsOnValues: boolean;
15
15
  };
16
- declare type RunAssertionParams = {
16
+ type RunAssertionParams = {
17
17
  ctx: AssertionContext;
18
18
  assert: AssertToApply;
19
19
  assertionProperty?: string;
@@ -19,7 +19,7 @@ function getPredicatesFromLocators(locators) {
19
19
  return [matchKeysPredicate, filterInPredicate, filterOutPredicate].filter(utils_1.isTruthy);
20
20
  }
21
21
  function getAssertsToApply(assertion) {
22
- const assertsToApply = utils_1.keysOf(asserts_1.asserts)
22
+ const assertsToApply = (0, utils_1.keysOf)(asserts_1.asserts)
23
23
  .filter((assertName) => assertion.assertions[assertName] !== undefined)
24
24
  .map((assertName) => {
25
25
  return {
@@ -82,7 +82,7 @@ function buildVisitorObject(assertion, subjectVisitor) {
82
82
  const context = assertion.where;
83
83
  for (let index = 0; index < context.length; index++) {
84
84
  const assertionDefinitionNode = context[index];
85
- if (!utils_1.isString((_a = assertionDefinitionNode.subject) === null || _a === void 0 ? void 0 : _a.type)) {
85
+ if (!(0, utils_1.isString)((_a = assertionDefinitionNode.subject) === null || _a === void 0 ? void 0 : _a.type)) {
86
86
  throw new Error(`${assertion.assertionId} -> where -> [${index}]: 'type' (String) is required`);
87
87
  }
88
88
  const locatorPredicates = getPredicatesFromLocators(assertionDefinitionNode.subject);
@@ -191,7 +191,7 @@ function runAssertion({ assert, ctx, assertionProperty, }) {
191
191
  var _a;
192
192
  const currentLocation = assert.name === 'ref' ? ctx.rawLocation : ctx.location;
193
193
  if (assertionProperty) {
194
- const values = ref_utils_1.isRef(ctx.node[assertionProperty])
194
+ const values = (0, ref_utils_1.isRef)(ctx.node[assertionProperty])
195
195
  ? (_a = ctx.resolve(ctx.node[assertionProperty])) === null || _a === void 0 ? void 0 : _a.node
196
196
  : ctx.node[assertionProperty];
197
197
  const rawValues = ctx.rawNode[assertionProperty];
@@ -7,7 +7,7 @@ const InfoContact = () => {
7
7
  Info(info, { report, location }) {
8
8
  if (!info.contact) {
9
9
  report({
10
- message: utils_1.missingRequiredField('Info', 'contact'),
10
+ message: (0, utils_1.missingRequiredField)('Info', 'contact'),
11
11
  location: location.child('contact').key(),
12
12
  });
13
13
  }
@@ -5,7 +5,7 @@ const utils_1 = require("../utils");
5
5
  const InfoLicenseUrl = () => {
6
6
  return {
7
7
  License(license, ctx) {
8
- utils_1.validateDefinedAndNonEmpty('url', license, ctx);
8
+ (0, utils_1.validateDefinedAndNonEmpty)('url', license, ctx);
9
9
  },
10
10
  };
11
11
  };
@@ -7,7 +7,7 @@ const InfoLicense = () => {
7
7
  Info(info, { report }) {
8
8
  if (!info.license) {
9
9
  report({
10
- message: utils_1.missingRequiredField('Info', 'license'),
10
+ message: (0, utils_1.missingRequiredField)('Info', 'license'),
11
11
  location: { reportOnKey: true },
12
12
  });
13
13
  }
@@ -8,10 +8,10 @@ const NoEnumTypeMismatch = () => {
8
8
  if (schema.enum && !Array.isArray(schema.enum))
9
9
  return;
10
10
  if (schema.enum && schema.type && !Array.isArray(schema.type)) {
11
- const typeMismatchedValues = schema.enum.filter((item) => !utils_1.matchesJsonSchemaType(item, schema.type, schema.nullable));
11
+ const typeMismatchedValues = schema.enum.filter((item) => !(0, utils_1.matchesJsonSchemaType)(item, schema.type, schema.nullable));
12
12
  for (const mismatchedValue of typeMismatchedValues) {
13
13
  report({
14
- message: `All values of \`enum\` field must be of the same type as the \`type\` field: expected "${schema.type}" but received "${utils_1.oasTypeOf(mismatchedValue)}".`,
14
+ message: `All values of \`enum\` field must be of the same type as the \`type\` field: expected "${schema.type}" but received "${(0, utils_1.oasTypeOf)(mismatchedValue)}".`,
15
15
  location: location.child(['enum', schema.enum.indexOf(mismatchedValue)]),
16
16
  });
17
17
  }
@@ -21,7 +21,7 @@ const NoEnumTypeMismatch = () => {
21
21
  for (const enumValue of schema.enum) {
22
22
  mismatchedResults[enumValue] = [];
23
23
  for (const type of schema.type) {
24
- const valid = utils_1.matchesJsonSchemaType(enumValue, type, schema.nullable);
24
+ const valid = (0, utils_1.matchesJsonSchemaType)(enumValue, type, schema.nullable);
25
25
  if (!valid)
26
26
  mismatchedResults[enumValue].push(type);
27
27
  }
@@ -11,11 +11,11 @@ const NoHttpVerbsInPaths = ({ splitIntoWords }) => {
11
11
  return;
12
12
  const pathSegments = pathKey.split('/');
13
13
  for (const pathSegment of pathSegments) {
14
- if (!pathSegment || utils_1.isPathParameter(pathSegment))
14
+ if (!pathSegment || (0, utils_1.isPathParameter)(pathSegment))
15
15
  continue;
16
16
  const isHttpMethodIncluded = (method) => {
17
17
  return splitIntoWords
18
- ? utils_1.splitCamelCaseIntoWords(pathSegment).has(method)
18
+ ? (0, utils_1.splitCamelCaseIntoWords)(pathSegment).has(method)
19
19
  : pathSegment.toLocaleLowerCase().includes(method);
20
20
  };
21
21
  for (const method of httpMethods) {
@@ -4,17 +4,17 @@ exports.NoInvalidParameterExamples = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  const NoInvalidParameterExamples = (opts) => {
6
6
  var _a;
7
- const allowAdditionalProperties = (_a = utils_1.getAdditionalPropertiesOption(opts)) !== null && _a !== void 0 ? _a : false;
7
+ const allowAdditionalProperties = (_a = (0, utils_1.getAdditionalPropertiesOption)(opts)) !== null && _a !== void 0 ? _a : false;
8
8
  return {
9
9
  Parameter: {
10
10
  leave(parameter, ctx) {
11
11
  if (parameter.example) {
12
- utils_1.validateExample(parameter.example, parameter.schema, ctx.location.child('example'), ctx, allowAdditionalProperties);
12
+ (0, utils_1.validateExample)(parameter.example, parameter.schema, ctx.location.child('example'), ctx, allowAdditionalProperties);
13
13
  }
14
14
  if (parameter.examples) {
15
15
  for (const [key, example] of Object.entries(parameter.examples)) {
16
16
  if ('value' in example) {
17
- utils_1.validateExample(example.value, parameter.schema, ctx.location.child(['examples', key]), ctx, true);
17
+ (0, utils_1.validateExample)(example.value, parameter.schema, ctx.location.child(['examples', key]), ctx, true);
18
18
  }
19
19
  }
20
20
  }
@@ -4,17 +4,17 @@ exports.NoInvalidSchemaExamples = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  const NoInvalidSchemaExamples = (opts) => {
6
6
  var _a;
7
- const allowAdditionalProperties = (_a = utils_1.getAdditionalPropertiesOption(opts)) !== null && _a !== void 0 ? _a : false;
7
+ const allowAdditionalProperties = (_a = (0, utils_1.getAdditionalPropertiesOption)(opts)) !== null && _a !== void 0 ? _a : false;
8
8
  return {
9
9
  Schema: {
10
10
  leave(schema, ctx) {
11
11
  if (schema.examples) {
12
12
  for (const example of schema.examples) {
13
- utils_1.validateExample(example, schema, ctx.location.child(['examples', schema.examples.indexOf(example)]), ctx, allowAdditionalProperties);
13
+ (0, utils_1.validateExample)(example, schema, ctx.location.child(['examples', schema.examples.indexOf(example)]), ctx, allowAdditionalProperties);
14
14
  }
15
15
  }
16
16
  if (schema.example) {
17
- utils_1.validateExample(schema.example, schema, ctx.location.child('example'), ctx, true);
17
+ (0, utils_1.validateExample)(schema.example, schema, ctx.location.child('example'), ctx, true);
18
18
  }
19
19
  },
20
20
  },
@@ -7,7 +7,7 @@ const Operation2xxResponse = ({ validateWebhooks }) => {
7
7
  Paths: {
8
8
  Responses(responses, { report }) {
9
9
  const codes = Object.keys(responses || {});
10
- utils_1.validateResponseCodes(codes, '2XX', { report });
10
+ (0, utils_1.validateResponseCodes)(codes, '2XX', { report });
11
11
  },
12
12
  },
13
13
  WebhooksMap: {
@@ -15,7 +15,7 @@ const Operation2xxResponse = ({ validateWebhooks }) => {
15
15
  if (!validateWebhooks)
16
16
  return;
17
17
  const codes = Object.keys(responses || {});
18
- utils_1.validateResponseCodes(codes, '2XX', { report });
18
+ (0, utils_1.validateResponseCodes)(codes, '2XX', { report });
19
19
  },
20
20
  },
21
21
  };
@@ -7,7 +7,7 @@ const Operation4xxResponse = ({ validateWebhooks }) => {
7
7
  Paths: {
8
8
  Responses(responses, { report }) {
9
9
  const codes = Object.keys(responses || {});
10
- utils_1.validateResponseCodes(codes, '4XX', { report });
10
+ (0, utils_1.validateResponseCodes)(codes, '4XX', { report });
11
11
  },
12
12
  },
13
13
  WebhooksMap: {
@@ -15,7 +15,7 @@ const Operation4xxResponse = ({ validateWebhooks }) => {
15
15
  if (!validateWebhooks)
16
16
  return;
17
17
  const codes = Object.keys(responses || {});
18
- utils_1.validateResponseCodes(codes, '4XX', { report });
18
+ (0, utils_1.validateResponseCodes)(codes, '4XX', { report });
19
19
  },
20
20
  },
21
21
  };
@@ -5,7 +5,7 @@ const utils_1 = require("../utils");
5
5
  const OperationDescription = () => {
6
6
  return {
7
7
  Operation(operation, ctx) {
8
- utils_1.validateDefinedAndNonEmpty('description', operation, ctx);
8
+ (0, utils_1.validateDefinedAndNonEmpty)('description', operation, ctx);
9
9
  },
10
10
  };
11
11
  };
@@ -7,7 +7,7 @@ const OperationOperationId = () => {
7
7
  Root: {
8
8
  PathItem: {
9
9
  Operation(operation, ctx) {
10
- utils_1.validateDefinedAndNonEmpty('operationId', operation, ctx);
10
+ (0, utils_1.validateDefinedAndNonEmpty)('operationId', operation, ctx);
11
11
  },
12
12
  },
13
13
  },
@@ -5,7 +5,7 @@ const utils_1 = require("../utils");
5
5
  const OperationSummary = () => {
6
6
  return {
7
7
  Operation(operation, ctx) {
8
- utils_1.validateDefinedAndNonEmpty('summary', operation, ctx);
8
+ (0, utils_1.validateDefinedAndNonEmpty)('summary', operation, ctx);
9
9
  },
10
10
  };
11
11
  };
@@ -17,7 +17,7 @@ const PathSegmentPlural = (opts) => {
17
17
  for (const pathSegment of pathSegments) {
18
18
  if (exceptions && exceptions.includes(pathSegment))
19
19
  continue;
20
- if (!utils_1.isPathParameter(pathSegment) && utils_1.isSingular(pathSegment)) {
20
+ if (!(0, utils_1.isPathParameter)(pathSegment) && (0, utils_1.isSingular)(pathSegment)) {
21
21
  report({
22
22
  message: `path segment \`${pathSegment}\` should be plural.`,
23
23
  location: location.key(),
@@ -9,8 +9,8 @@ const ResponseContainsHeader = (options) => {
9
9
  Response: {
10
10
  enter: (response, { report, location, key }) => {
11
11
  const expectedHeaders = names[key] ||
12
- names[utils_1.getMatchingStatusCodeRange(key)] ||
13
- names[utils_1.getMatchingStatusCodeRange(key).toLowerCase()] ||
12
+ names[(0, utils_1.getMatchingStatusCodeRange)(key)] ||
13
+ names[(0, utils_1.getMatchingStatusCodeRange)(key).toLowerCase()] ||
14
14
  [];
15
15
  for (const expectedHeader of expectedHeaders) {
16
16
  if (!(response === null || response === void 0 ? void 0 : response.headers) ||
@@ -18,7 +18,7 @@ const SpecStrictRefs = () => {
18
18
  return {
19
19
  any(_node, { report, rawNode, rawLocation, type }) {
20
20
  const shouldCheck = !nodesToSkip.includes(type.name);
21
- if (shouldCheck && ref_utils_1.isRef(rawNode)) {
21
+ if (shouldCheck && (0, ref_utils_1.isRef)(rawNode)) {
22
22
  report({
23
23
  message: 'Field $ref is not expected here.',
24
24
  location: rawLocation.child('$ref').key(),
@@ -9,7 +9,7 @@ const Spec = () => {
9
9
  return {
10
10
  any(node, { report, type, location, rawLocation, key, resolve, ignoreNextVisitorsOnNode }) {
11
11
  var _a, _b, _c, _d, _e, _f;
12
- const nodeType = utils_1.oasTypeOf(node);
12
+ const nodeType = (0, utils_1.oasTypeOf)(node);
13
13
  const refLocation = rawLocation !== location ? rawLocation : undefined;
14
14
  if (type.items) {
15
15
  if (nodeType !== 'array') {
@@ -43,7 +43,7 @@ const Spec = () => {
43
43
  }
44
44
  }
45
45
  const allowed = (_a = type.allowed) === null || _a === void 0 ? void 0 : _a.call(type, node);
46
- if (allowed && utils_2.isPlainObject(node)) {
46
+ if (allowed && (0, utils_2.isPlainObject)(node)) {
47
47
  for (const propName in node) {
48
48
  if (allowed.includes(propName) ||
49
49
  (type.extensionsPrefix && propName.startsWith(type.extensionsPrefix)) ||
@@ -80,17 +80,17 @@ const Spec = () => {
80
80
  propType = type.additionalProperties;
81
81
  if (typeof propType === 'function')
82
82
  propType = propType(propValue, propName);
83
- if (types_1.isNamedType(propType)) {
83
+ if ((0, types_1.isNamedType)(propType)) {
84
84
  continue; // do nothing for named schema, it is executed with the next any call
85
85
  }
86
86
  const propSchema = propType;
87
- const propValueType = utils_1.oasTypeOf(propValue);
87
+ const propValueType = (0, utils_1.oasTypeOf)(propValue);
88
88
  if (propSchema === undefined) {
89
89
  if (propName.startsWith('x-'))
90
90
  continue;
91
91
  report({
92
92
  message: `Property \`${propName}\` is not expected here.`,
93
- suggest: utils_1.getSuggest(propName, Object.keys(type.properties)),
93
+ suggest: (0, utils_1.getSuggest)(propName, Object.keys(type.properties)),
94
94
  from: refLocation,
95
95
  location: propLocation.key(),
96
96
  });
@@ -99,24 +99,24 @@ const Spec = () => {
99
99
  if (propSchema === null) {
100
100
  continue; // just defined, no validation
101
101
  }
102
- if (propSchema.resolvable !== false && ref_utils_1.isRef(propValue)) {
102
+ if (propSchema.resolvable !== false && (0, ref_utils_1.isRef)(propValue)) {
103
103
  propValue = resolve(propValue).node;
104
104
  }
105
105
  if (propSchema.items && ((_c = propSchema.items) === null || _c === void 0 ? void 0 : _c.enum) && Array.isArray(propValue)) {
106
106
  for (let i = 0; i < propValue.length; i++) {
107
- utils_1.validateSchemaEnumType((_d = propSchema.items) === null || _d === void 0 ? void 0 : _d.enum, propValue[i], propName, refLocation, {
107
+ (0, utils_1.validateSchemaEnumType)((_d = propSchema.items) === null || _d === void 0 ? void 0 : _d.enum, propValue[i], propName, refLocation, {
108
108
  report,
109
109
  location: location.child([propName, i]),
110
110
  });
111
111
  }
112
112
  }
113
113
  if (propSchema.enum) {
114
- utils_1.validateSchemaEnumType(propSchema.enum, propValue, propName, refLocation, {
114
+ (0, utils_1.validateSchemaEnumType)(propSchema.enum, propValue, propName, refLocation, {
115
115
  report,
116
116
  location: location.child([propName]),
117
117
  });
118
118
  }
119
- else if (propSchema.type && !utils_1.matchesJsonSchemaType(propValue, propSchema.type, false)) {
119
+ else if (propSchema.type && !(0, utils_1.matchesJsonSchemaType)(propValue, propSchema.type, false)) {
120
120
  report({
121
121
  message: `Expected type \`${propSchema.type}\` but got \`${propValueType}\`.`,
122
122
  from: refLocation,
@@ -128,9 +128,9 @@ const Spec = () => {
128
128
  const itemsType = (_f = propSchema.items) === null || _f === void 0 ? void 0 : _f.type;
129
129
  for (let i = 0; i < propValue.length; i++) {
130
130
  const item = propValue[i];
131
- if (!utils_1.matchesJsonSchemaType(item, itemsType, false)) {
131
+ if (!(0, utils_1.matchesJsonSchemaType)(item, itemsType, false)) {
132
132
  report({
133
- message: `Expected type \`${itemsType}\` but got \`${utils_1.oasTypeOf(item)}\`.`,
133
+ message: `Expected type \`${itemsType}\` but got \`${(0, utils_1.oasTypeOf)(item)}\`.`,
134
134
  from: refLocation,
135
135
  location: propLocation.child([i]),
136
136
  });
@@ -5,7 +5,7 @@ const utils_1 = require("../utils");
5
5
  const TagDescription = () => {
6
6
  return {
7
7
  Tag(tag, ctx) {
8
- utils_1.validateDefinedAndNonEmpty('description', tag, ctx);
8
+ (0, utils_1.validateDefinedAndNonEmpty)('description', tag, ctx);
9
9
  },
10
10
  };
11
11
  };
@@ -1,5 +1,5 @@
1
1
  import { Oas2Rule } from '../../visitors';
2
- export declare type BooleanParameterPrefixesOptions = {
2
+ export type BooleanParameterPrefixesOptions = {
3
3
  prefixes?: string[];
4
4
  };
5
5
  export declare const BooleanParameterPrefixes: Oas2Rule;
@@ -1,47 +1,3 @@
1
- import { Oas2Rule } from '../../visitors';
2
- export declare const rules: {
3
- spec: Oas2Rule;
4
- 'no-invalid-schema-examples': any;
5
- 'no-invalid-parameter-examples': any;
6
- 'info-contact': Oas2Rule;
7
- 'info-license': Oas2Rule;
8
- 'info-license-url': Oas2Rule;
9
- 'tag-description': Oas2Rule;
10
- 'tags-alphabetical': Oas2Rule;
11
- 'paths-kebab-case': Oas2Rule;
12
- 'no-enum-type-mismatch': Oas2Rule;
13
- 'boolean-parameter-prefixes': Oas2Rule;
14
- 'no-path-trailing-slash': Oas2Rule;
15
- 'operation-2xx-response': Oas2Rule;
16
- 'operation-4xx-response': Oas2Rule;
17
- assertions: Oas2Rule;
18
- 'operation-operationId-unique': Oas2Rule;
19
- 'operation-parameters-unique': Oas2Rule;
20
- 'path-parameters-defined': Oas2Rule;
21
- 'operation-tag-defined': Oas2Rule;
22
- 'path-declaration-must-exist': Oas2Rule;
23
- 'operation-operationId-url-safe': Oas2Rule;
24
- 'operation-operationId': Oas2Rule;
25
- 'operation-summary': Oas2Rule;
26
- 'operation-description': Oas2Rule;
27
- 'path-not-include-query': Oas2Rule;
28
- 'path-params-defined': Oas2Rule;
29
- 'parameter-description': Oas2Rule;
30
- 'operation-singular-tag': Oas2Rule;
31
- 'security-defined': Oas2Rule;
32
- 'no-unresolved-refs': Oas2Rule;
33
- 'no-identical-paths': Oas2Rule;
34
- 'no-ambiguous-paths': Oas2Rule;
35
- 'path-http-verbs-order': Oas2Rule;
36
- 'no-http-verbs-in-paths': Oas2Rule;
37
- 'path-excludes-patterns': Oas2Rule;
38
- 'request-mime-type': Oas2Rule;
39
- 'response-mime-type': Oas2Rule;
40
- 'path-segment-plural': Oas2Rule;
41
- 'response-contains-header': Oas2Rule;
42
- 'response-contains-property': Oas2Rule;
43
- 'scalar-property-missing-example': import("../../visitors").Oas3Rule | Oas2Rule;
44
- 'required-string-property-missing-min-length': import("../../visitors").Oas3Rule;
45
- 'spec-strict-refs': import("../../visitors").Oas3Rule | Oas2Rule;
46
- };
1
+ import type { Oas2RuleSet } from 'core/src/oas-types';
2
+ export declare const rules: Oas2RuleSet<'built-in'>;
47
3
  export declare const preprocessors: {};
@@ -43,7 +43,7 @@ const RemoveUnusedComponents = () => {
43
43
  }
44
44
  });
45
45
  for (const component of rootComponents) {
46
- if (utils_1.isEmptyObject(root[component])) {
46
+ if ((0, utils_1.isEmptyObject)(root[component])) {
47
47
  delete root[component];
48
48
  }
49
49
  }
@@ -5,11 +5,11 @@ const utils_1 = require("../../utils");
5
5
  const RequestMimeType = ({ allowedValues }) => {
6
6
  return {
7
7
  Root(root, ctx) {
8
- utils_1.validateMimeType({ type: 'consumes', value: root }, ctx, allowedValues);
8
+ (0, utils_1.validateMimeType)({ type: 'consumes', value: root }, ctx, allowedValues);
9
9
  },
10
10
  Operation: {
11
11
  leave(operation, ctx) {
12
- utils_1.validateMimeType({ type: 'consumes', value: operation }, ctx, allowedValues);
12
+ (0, utils_1.validateMimeType)({ type: 'consumes', value: operation }, ctx, allowedValues);
13
13
  },
14
14
  },
15
15
  };
@@ -19,8 +19,8 @@ const ResponseContainsProperty = (options) => {
19
19
  if (schema.type !== 'object')
20
20
  return;
21
21
  const expectedProperties = names[key] ||
22
- names[utils_1.getMatchingStatusCodeRange(key)] ||
23
- names[utils_1.getMatchingStatusCodeRange(key).toLowerCase()] ||
22
+ names[(0, utils_1.getMatchingStatusCodeRange)(key)] ||
23
+ names[(0, utils_1.getMatchingStatusCodeRange)(key).toLowerCase()] ||
24
24
  [];
25
25
  for (const expectedProperty of expectedProperties) {
26
26
  if (!((_a = schema.properties) === null || _a === void 0 ? void 0 : _a[expectedProperty])) {
@@ -5,11 +5,11 @@ const utils_1 = require("../../utils");
5
5
  const ResponseMimeType = ({ allowedValues }) => {
6
6
  return {
7
7
  Root(root, ctx) {
8
- utils_1.validateMimeType({ type: 'produces', value: root }, ctx, allowedValues);
8
+ (0, utils_1.validateMimeType)({ type: 'produces', value: root }, ctx, allowedValues);
9
9
  },
10
10
  Operation: {
11
11
  leave(operation, ctx) {
12
- utils_1.validateMimeType({ type: 'produces', value: operation }, ctx, allowedValues);
12
+ (0, utils_1.validateMimeType)({ type: 'produces', value: operation }, ctx, allowedValues);
13
13
  },
14
14
  },
15
15
  };
@@ -1,5 +1,5 @@
1
1
  import { Oas3Rule } from '../../visitors';
2
- export declare type BooleanParameterPrefixesOptions = {
2
+ export type BooleanParameterPrefixesOptions = {
3
3
  prefixes?: string[];
4
4
  };
5
5
  export declare const BooleanParameterPrefixes: Oas3Rule;
@@ -1,3 +1,3 @@
1
1
  import { Oas3RuleSet } from '../../oas-types';
2
- export declare const rules: Oas3RuleSet;
2
+ export declare const rules: Oas3RuleSet<'built-in'>;
3
3
  export declare const preprocessors: {};
@@ -65,7 +65,6 @@ exports.rules = {
65
65
  assertions: assertions_1.Assertions,
66
66
  'operation-operationId-unique': operation_operationId_unique_1.OperationIdUnique,
67
67
  'operation-parameters-unique': operation_parameters_unique_1.OperationParametersUnique,
68
- 'path-parameters-defined': path_params_defined_1.PathParamsDefined,
69
68
  'operation-tag-defined': operation_tag_defined_1.OperationTagDefined,
70
69
  'no-example-value-and-externalValue': no_example_value_and_externalValue_1.NoExampleValueAndExternalValue,
71
70
  'no-enum-type-mismatch': no_enum_type_mismatch_1.NoEnumTypeMismatch,
@@ -82,6 +81,7 @@ exports.rules = {
82
81
  'operation-description': operation_description_1.OperationDescription,
83
82
  'no-unused-components': no_unused_components_1.NoUnusedComponents,
84
83
  'path-not-include-query': path_not_include_query_1.PathNotIncludeQuery,
84
+ 'path-parameters-defined': path_params_defined_1.PathParamsDefined,
85
85
  'path-params-defined': path_params_defined_1.PathParamsDefined,
86
86
  'parameter-description': parameter_description_1.ParameterDescription,
87
87
  'operation-singular-tag': operation_singular_tag_1.OperationSingularTag,
@@ -5,7 +5,7 @@ const ref_utils_1 = require("../../ref-utils");
5
5
  const utils_1 = require("../utils");
6
6
  const ValidContentExamples = (opts) => {
7
7
  var _a;
8
- const allowAdditionalProperties = (_a = utils_1.getAdditionalPropertiesOption(opts)) !== null && _a !== void 0 ? _a : false;
8
+ const allowAdditionalProperties = (_a = (0, utils_1.getAdditionalPropertiesOption)(opts)) !== null && _a !== void 0 ? _a : false;
9
9
  return {
10
10
  MediaType: {
11
11
  leave(mediaType, ctx) {
@@ -21,14 +21,14 @@ const ValidContentExamples = (opts) => {
21
21
  }
22
22
  }
23
23
  function resolveAndValidateExample(example, location, isMultiple) {
24
- if (ref_utils_1.isRef(example)) {
24
+ if ((0, ref_utils_1.isRef)(example)) {
25
25
  const resolved = resolve(example);
26
26
  if (!resolved.location)
27
27
  return;
28
28
  location = isMultiple ? resolved.location.child('value') : resolved.location;
29
29
  example = resolved.node;
30
30
  }
31
- utils_1.validateExample(isMultiple ? example.value : example, mediaType.schema, location, ctx, allowAdditionalProperties);
31
+ (0, utils_1.validateExample)(isMultiple ? example.value : example, mediaType.schema, location, ctx, allowAdditionalProperties);
32
32
  }
33
33
  },
34
34
  },
@@ -23,11 +23,11 @@ const Operation4xxProblemDetailsRfc7807 = () => {
23
23
  return key !== 'application/problem+json';
24
24
  },
25
25
  enter(media, ctx) {
26
- utils_1.validateDefinedAndNonEmpty('schema', media, ctx);
26
+ (0, utils_1.validateDefinedAndNonEmpty)('schema', media, ctx);
27
27
  },
28
28
  SchemaProperties(schema, ctx) {
29
- utils_1.validateDefinedAndNonEmpty('type', schema, ctx);
30
- utils_1.validateDefinedAndNonEmpty('title', schema, ctx);
29
+ (0, utils_1.validateDefinedAndNonEmpty)('type', schema, ctx);
30
+ (0, utils_1.validateDefinedAndNonEmpty)('title', schema, ctx);
31
31
  },
32
32
  },
33
33
  },
@@ -39,12 +39,12 @@ const RemoveUnusedComponents = () => {
39
39
  const componentChild = root.components[componentType];
40
40
  delete componentChild[name];
41
41
  data.removedCount++;
42
- if (utils_1.isEmptyObject(componentChild)) {
42
+ if ((0, utils_1.isEmptyObject)(componentChild)) {
43
43
  delete root.components[componentType];
44
44
  }
45
45
  }
46
46
  });
47
- if (utils_1.isEmptyObject(root.components)) {
47
+ if ((0, utils_1.isEmptyObject)(root.components)) {
48
48
  delete root.components;
49
49
  }
50
50
  },
@@ -7,14 +7,14 @@ const RequestMimeType = ({ allowedValues }) => {
7
7
  Paths: {
8
8
  RequestBody: {
9
9
  leave(requestBody, ctx) {
10
- utils_1.validateMimeTypeOAS3({ type: 'consumes', value: requestBody }, ctx, allowedValues);
10
+ (0, utils_1.validateMimeTypeOAS3)({ type: 'consumes', value: requestBody }, ctx, allowedValues);
11
11
  },
12
12
  },
13
13
  Callback: {
14
14
  RequestBody() { },
15
15
  Response: {
16
16
  leave(response, ctx) {
17
- utils_1.validateMimeTypeOAS3({ type: 'consumes', value: response }, ctx, allowedValues);
17
+ (0, utils_1.validateMimeTypeOAS3)({ type: 'consumes', value: response }, ctx, allowedValues);
18
18
  },
19
19
  },
20
20
  },
@@ -22,7 +22,7 @@ const RequestMimeType = ({ allowedValues }) => {
22
22
  WebhooksMap: {
23
23
  Response: {
24
24
  leave(response, ctx) {
25
- utils_1.validateMimeTypeOAS3({ type: 'consumes', value: response }, ctx, allowedValues);
25
+ (0, utils_1.validateMimeTypeOAS3)({ type: 'consumes', value: response }, ctx, allowedValues);
26
26
  },
27
27
  },
28
28
  },
@@ -20,8 +20,8 @@ const ResponseContainsProperty = (options) => {
20
20
  if (schema.type !== 'object')
21
21
  return;
22
22
  const expectedProperties = names[key] ||
23
- names[utils_1.getMatchingStatusCodeRange(key)] ||
24
- names[utils_1.getMatchingStatusCodeRange(key).toLowerCase()] ||
23
+ names[(0, utils_1.getMatchingStatusCodeRange)(key)] ||
24
+ names[(0, utils_1.getMatchingStatusCodeRange)(key).toLowerCase()] ||
25
25
  [];
26
26
  for (const expectedProperty of expectedProperties) {
27
27
  if (!((_a = schema.properties) === null || _a === void 0 ? void 0 : _a[expectedProperty])) {
@@ -7,14 +7,14 @@ const ResponseMimeType = ({ allowedValues }) => {
7
7
  Paths: {
8
8
  Response: {
9
9
  leave(response, ctx) {
10
- utils_1.validateMimeTypeOAS3({ type: 'produces', value: response }, ctx, allowedValues);
10
+ (0, utils_1.validateMimeTypeOAS3)({ type: 'produces', value: response }, ctx, allowedValues);
11
11
  },
12
12
  },
13
13
  Callback: {
14
14
  Response() { },
15
15
  RequestBody: {
16
16
  leave(requestBody, ctx) {
17
- utils_1.validateMimeTypeOAS3({ type: 'produces', value: requestBody }, ctx, allowedValues);
17
+ (0, utils_1.validateMimeTypeOAS3)({ type: 'produces', value: requestBody }, ctx, allowedValues);
18
18
  },
19
19
  },
20
20
  },
@@ -22,7 +22,7 @@ const ResponseMimeType = ({ allowedValues }) => {
22
22
  WebhooksMap: {
23
23
  RequestBody: {
24
24
  leave(requestBody, ctx) {
25
- utils_1.validateMimeTypeOAS3({ type: 'produces', value: requestBody }, ctx, allowedValues);
25
+ (0, utils_1.validateMimeTypeOAS3)({ type: 'produces', value: requestBody }, ctx, allowedValues);
26
26
  },
27
27
  },
28
28
  },