@redocly/openapi-core 1.3.0 → 1.4.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 (202) hide show
  1. package/CHANGELOG.md +18 -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 +25 -25
  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 +6 -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.js +26 -14
  30. package/lib/decorators/common/filters/filter-helper.js +4 -4
  31. package/lib/decorators/common/filters/filter-in.js +2 -2
  32. package/lib/decorators/common/filters/filter-out.js +2 -2
  33. package/lib/decorators/common/info-description-override.js +1 -1
  34. package/lib/decorators/common/media-type-examples-override.js +3 -3
  35. package/lib/decorators/common/operation-description-override.js +1 -1
  36. package/lib/decorators/common/registry-dependencies.js +1 -1
  37. package/lib/decorators/common/remove-x-internal.js +4 -4
  38. package/lib/decorators/common/tag-description-override.js +1 -1
  39. package/lib/decorators/oas2/remove-unused-components.d.ts +2 -0
  40. package/lib/{rules → decorators}/oas2/remove-unused-components.js +1 -1
  41. package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
  42. package/lib/{rules → decorators}/oas3/remove-unused-components.js +2 -2
  43. package/lib/env.js +1 -1
  44. package/lib/format/codeframes.d.ts +6 -6
  45. package/lib/format/format.d.ts +2 -2
  46. package/lib/format/format.js +12 -12
  47. package/lib/js-yaml/index.d.ts +2 -2
  48. package/lib/js-yaml/index.js +2 -2
  49. package/lib/lint.js +18 -18
  50. package/lib/oas-types.d.ts +12 -10
  51. package/lib/oas-types.js +2 -2
  52. package/lib/redocly/index.js +10 -10
  53. package/lib/redocly/registry-api.js +2 -2
  54. package/lib/resolve.d.ts +4 -4
  55. package/lib/resolve.js +18 -18
  56. package/lib/rules/ajv.js +1 -1
  57. package/lib/rules/async2/index.d.ts +2 -11
  58. package/lib/rules/common/assertions/asserts.d.ts +3 -3
  59. package/lib/rules/common/assertions/asserts.js +21 -21
  60. package/lib/rules/common/assertions/index.d.ts +4 -4
  61. package/lib/rules/common/assertions/index.js +3 -3
  62. package/lib/rules/common/assertions/utils.d.ts +4 -4
  63. package/lib/rules/common/assertions/utils.js +3 -3
  64. package/lib/rules/common/info-contact.js +1 -1
  65. package/lib/rules/common/info-license-url.js +1 -1
  66. package/lib/rules/common/info-license.js +1 -1
  67. package/lib/rules/common/no-enum-type-mismatch.js +3 -3
  68. package/lib/rules/common/no-http-verbs-in-paths.js +2 -2
  69. package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
  70. package/lib/rules/common/no-invalid-schema-examples.js +3 -3
  71. package/lib/rules/common/operation-2xx-response.js +2 -2
  72. package/lib/rules/common/operation-4xx-response.js +2 -2
  73. package/lib/rules/common/operation-description.js +1 -1
  74. package/lib/rules/common/operation-operationId.js +1 -1
  75. package/lib/rules/common/operation-summary.js +1 -1
  76. package/lib/rules/common/path-segment-plural.js +1 -1
  77. package/lib/rules/common/response-contains-header.js +2 -2
  78. package/lib/rules/common/spec-strict-refs.js +1 -1
  79. package/lib/rules/common/spec.js +11 -11
  80. package/lib/rules/common/tag-description.js +1 -1
  81. package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -1
  82. package/lib/rules/oas2/index.d.ts +2 -46
  83. package/lib/rules/oas2/request-mime-type.js +2 -2
  84. package/lib/rules/oas2/response-contains-property.js +2 -2
  85. package/lib/rules/oas2/response-mime-type.js +2 -2
  86. package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -1
  87. package/lib/rules/oas3/index.d.ts +1 -1
  88. package/lib/rules/oas3/index.js +1 -1
  89. package/lib/rules/oas3/no-invalid-media-type-examples.js +3 -3
  90. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
  91. package/lib/rules/oas3/request-mime-type.js +3 -3
  92. package/lib/rules/oas3/response-contains-property.js +2 -2
  93. package/lib/rules/oas3/response-mime-type.js +3 -3
  94. package/lib/rules/utils.js +3 -3
  95. package/lib/types/asyncapi.js +21 -21
  96. package/lib/types/index.d.ts +8 -8
  97. package/lib/types/oas2.js +14 -14
  98. package/lib/types/oas3.js +27 -27
  99. package/lib/types/oas3_1.js +18 -6
  100. package/lib/types/redocly-yaml.d.ts +11 -0
  101. package/lib/types/redocly-yaml.js +71 -53
  102. package/lib/types/theme-config.js +1 -1
  103. package/lib/typings/common.d.ts +2 -2
  104. package/lib/typings/openapi.d.ts +6 -6
  105. package/lib/typings/swagger.d.ts +3 -3
  106. package/lib/utils.d.ts +5 -5
  107. package/lib/utils.js +3 -3
  108. package/lib/visitors.d.ts +38 -40
  109. package/lib/walk.d.ts +14 -15
  110. package/lib/walk.js +11 -11
  111. package/package.json +2 -2
  112. package/src/__tests__/lint.test.ts +40 -40
  113. package/src/__tests__/normalizeVisitors.test.ts +23 -5
  114. package/src/__tests__/ref-utils.test.ts +7 -7
  115. package/src/__tests__/resolve-http.test.ts +10 -10
  116. package/src/__tests__/resolve.test.ts +39 -39
  117. package/src/__tests__/walk.test.ts +48 -48
  118. package/src/bundle.ts +4 -4
  119. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +95 -32
  120. package/src/config/__tests__/__snapshots__/config.test.ts.snap +81 -81
  121. package/src/config/__tests__/config-resolvers.test.ts +30 -1
  122. package/src/config/__tests__/config.test.ts +88 -88
  123. package/src/config/__tests__/load.test.ts +12 -8
  124. package/src/config/__tests__/utils.test.ts +18 -18
  125. package/src/config/all.ts +46 -9
  126. package/src/config/builtIn.ts +2 -0
  127. package/src/config/minimal.ts +36 -4
  128. package/src/config/recommended-strict.ts +93 -0
  129. package/src/config/recommended.ts +36 -4
  130. package/src/config/types.ts +22 -8
  131. package/src/config/utils.ts +15 -0
  132. package/src/decorators/common/media-type-examples-override.ts +2 -2
  133. package/src/{rules → decorators}/oas2/remove-unused-components.ts +3 -3
  134. package/src/{rules → decorators}/oas3/remove-unused-components.ts +3 -3
  135. package/src/env.ts +1 -1
  136. package/src/lint.ts +3 -3
  137. package/src/oas-types.ts +26 -3
  138. package/src/rules/__tests__/no-unresolved-refs.test.ts +26 -26
  139. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +12 -12
  140. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +7 -7
  141. package/src/rules/async2/index.ts +2 -1
  142. package/src/rules/common/__tests__/info-license.test.ts +6 -6
  143. package/src/rules/common/__tests__/license-url.test.ts +6 -6
  144. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +13 -13
  145. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +18 -18
  146. package/src/rules/common/__tests__/no-identical-paths.test.ts +5 -5
  147. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +12 -12
  148. package/src/rules/common/__tests__/operation-2xx-response.test.ts +18 -18
  149. package/src/rules/common/__tests__/operation-4xx-response.test.ts +23 -23
  150. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +6 -6
  151. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +5 -5
  152. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +16 -16
  153. package/src/rules/common/__tests__/operation-singular-tag.test.ts +6 -6
  154. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +10 -10
  155. package/src/rules/common/__tests__/path-not-include-query.test.ts +6 -6
  156. package/src/rules/common/__tests__/path-params-defined.test.ts +21 -21
  157. package/src/rules/common/__tests__/paths-kebab-case.test.ts +11 -11
  158. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +18 -18
  159. package/src/rules/common/__tests__/security-defined.test.ts +21 -21
  160. package/src/rules/common/__tests__/spec-strict-refs.test.ts +9 -9
  161. package/src/rules/common/__tests__/spec.test.ts +102 -102
  162. package/src/rules/common/__tests__/tag-description.test.ts +6 -6
  163. package/src/rules/common/__tests__/tags-alphabetical.test.ts +12 -12
  164. package/src/rules/common/assertions/__tests__/index.test.ts +15 -15
  165. package/src/rules/common/assertions/__tests__/utils.test.ts +9 -9
  166. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  167. package/src/rules/oas2/__tests__/response-contains-header.test.ts +13 -13
  168. package/src/rules/oas2/__tests__/response-contains-property.test.ts +8 -8
  169. package/src/rules/oas2/__tests__/spec/info.test.ts +21 -21
  170. package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
  171. package/src/rules/oas2/__tests__/spec/paths.test.ts +12 -12
  172. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
  173. package/src/rules/oas2/index.ts +3 -1
  174. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  175. package/src/rules/oas3/__tests__/component-name-unique.test.ts +186 -186
  176. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +18 -18
  177. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +6 -6
  178. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +36 -36
  179. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +11 -11
  180. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +7 -7
  181. package/src/rules/oas3/__tests__/no-unused-components.test.ts +31 -31
  182. package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +15 -15
  183. package/src/rules/oas3/__tests__/response-contains-header.test.ts +26 -26
  184. package/src/rules/oas3/__tests__/response-contains-property.test.ts +27 -27
  185. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
  186. package/src/rules/oas3/__tests__/spec/info.test.ts +21 -21
  187. package/src/rules/oas3/__tests__/spec/operation.test.ts +10 -10
  188. package/src/rules/oas3/__tests__/spec/paths.test.ts +13 -13
  189. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +2 -2
  190. package/src/rules/oas3/__tests__/spec/servers.test.ts +25 -25
  191. package/src/rules/oas3/__tests__/spec/spec.test.ts +56 -56
  192. package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +28 -28
  193. package/src/rules/oas3/index.ts +3 -3
  194. package/src/types/oas3_1.ts +12 -0
  195. package/src/types/redocly-yaml.ts +75 -40
  196. package/src/visitors.ts +10 -21
  197. package/src/walk.ts +23 -10
  198. package/tsconfig.tsbuildinfo +1 -1
  199. package/lib/rules/oas2/remove-unused-components.d.ts +0 -2
  200. package/lib/rules/oas3/remove-unused-components.d.ts +0 -2
  201. /package/src/{rules → decorators}/oas2/__tests__/remove-unused-components.test.ts +0 -0
  202. /package/src/{rules → decorators}/oas3/__tests__/remove-unused-components.test.ts +0 -0
@@ -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
  },
@@ -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
  },
@@ -90,7 +90,7 @@ function getSuggest(given, variants) {
90
90
  exports.getSuggest = getSuggest;
91
91
  function validateExample(example, schema, dataLoc, { resolve, location, report }, allowAdditionalProperties) {
92
92
  try {
93
- const { valid, errors } = ajv_1.validateJsonSchema(example, schema, location.child('schema'), dataLoc.pointer, resolve, allowAdditionalProperties);
93
+ const { valid, errors } = (0, ajv_1.validateJsonSchema)(example, schema, location.child('schema'), dataLoc.pointer, resolve, allowAdditionalProperties);
94
94
  if (!valid) {
95
95
  for (const error of errors) {
96
96
  report({
@@ -119,9 +119,9 @@ function getAdditionalPropertiesOption(opts) {
119
119
  return opts.allowAdditionalProperties;
120
120
  }
121
121
  if (opts.allowAdditionalProperties !== undefined) {
122
- utils_1.showErrorForDeprecatedField('disallowAdditionalProperties', 'allowAdditionalProperties', undefined);
122
+ (0, utils_1.showErrorForDeprecatedField)('disallowAdditionalProperties', 'allowAdditionalProperties', undefined);
123
123
  }
124
- utils_1.showWarningForDeprecatedField('disallowAdditionalProperties', 'allowAdditionalProperties');
124
+ (0, utils_1.showWarningForDeprecatedField)('disallowAdditionalProperties', 'allowAdditionalProperties');
125
125
  return !opts.disallowAdditionalProperties;
126
126
  }
127
127
  exports.getAdditionalPropertiesOption = getAdditionalPropertiesOption;
@@ -351,15 +351,15 @@ const Schema = {
351
351
  };
352
352
  }
353
353
  },
354
- allOf: _1.listOf('Schema'),
355
- anyOf: _1.listOf('Schema'),
356
- oneOf: _1.listOf('Schema'),
354
+ allOf: (0, _1.listOf)('Schema'),
355
+ anyOf: (0, _1.listOf)('Schema'),
356
+ oneOf: (0, _1.listOf)('Schema'),
357
357
  not: 'Schema',
358
358
  if: 'Schema',
359
359
  then: 'Schema',
360
360
  else: 'Schema',
361
- dependentSchemas: _1.listOf('Schema'),
362
- prefixItems: _1.listOf('Schema'),
361
+ dependentSchemas: (0, _1.listOf)('Schema'),
362
+ prefixItems: (0, _1.listOf)('Schema'),
363
363
  contains: 'Schema',
364
364
  minContains: { type: 'integer', minimum: 0 },
365
365
  maxContains: { type: 'integer', minimum: 0 },
@@ -422,7 +422,7 @@ const SchemaProperties = {
422
422
  const DiscriminatorMapping = {
423
423
  properties: {},
424
424
  additionalProperties: (value) => {
425
- if (ref_utils_1.isMappingRef(value)) {
425
+ if ((0, ref_utils_1.isMappingRef)(value)) {
426
426
  return { type: 'string', directResolveAs: 'Schema' };
427
427
  }
428
428
  else {
@@ -863,7 +863,7 @@ const SolaceDestination = {
863
863
  const SolaceOperationBinding = {
864
864
  properties: {
865
865
  bindingVersion: { type: 'string' },
866
- destinations: _1.listOf('SolaceDestination'),
866
+ destinations: (0, _1.listOf)('SolaceDestination'),
867
867
  },
868
868
  };
869
869
  OperationBindings.properties.solace = SolaceOperationBinding;
@@ -926,14 +926,14 @@ OperationBindings.properties.mercure = MercureOperationBinding;
926
926
  exports.AsyncApi2Types = {
927
927
  Root,
928
928
  Tag,
929
- TagList: _1.listOf('Tag'),
929
+ TagList: (0, _1.listOf)('Tag'),
930
930
  ServerMap,
931
931
  ExternalDocs,
932
932
  Server,
933
933
  ServerVariable,
934
- ServerVariablesMap: _1.mapOf('ServerVariable'),
934
+ ServerVariablesMap: (0, _1.mapOf)('ServerVariable'),
935
935
  SecurityRequirement,
936
- SecurityRequirementList: _1.listOf('SecurityRequirement'),
936
+ SecurityRequirementList: (0, _1.listOf)('SecurityRequirement'),
937
937
  Info,
938
938
  Contact,
939
939
  License,
@@ -1001,7 +1001,7 @@ exports.AsyncApi2Types = {
1001
1001
  ChannelMap,
1002
1002
  Channel,
1003
1003
  Parameter,
1004
- ParametersMap: _1.mapOf('Parameter'),
1004
+ ParametersMap: (0, _1.mapOf)('Parameter'),
1005
1005
  Operation,
1006
1006
  Schema,
1007
1007
  MessageExample,
@@ -1009,14 +1009,14 @@ exports.AsyncApi2Types = {
1009
1009
  DiscriminatorMapping,
1010
1010
  Discriminator,
1011
1011
  Components,
1012
- NamedSchemas: _1.mapOf('Schema'),
1013
- NamedMessages: _1.mapOf('Message'),
1014
- NamedMessageTraits: _1.mapOf('MessageTrait'),
1015
- NamedOperationTraits: _1.mapOf('OperationTrait'),
1016
- NamedParameters: _1.mapOf('Parameter'),
1017
- NamedSecuritySchemes: _1.mapOf('SecurityScheme'),
1018
- NamedCorrelationIds: _1.mapOf('CorrelationId'),
1019
- NamedStreamHeaders: _1.mapOf('StreamHeader'),
1012
+ NamedSchemas: (0, _1.mapOf)('Schema'),
1013
+ NamedMessages: (0, _1.mapOf)('Message'),
1014
+ NamedMessageTraits: (0, _1.mapOf)('MessageTrait'),
1015
+ NamedOperationTraits: (0, _1.mapOf)('OperationTrait'),
1016
+ NamedParameters: (0, _1.mapOf)('Parameter'),
1017
+ NamedSecuritySchemes: (0, _1.mapOf)('SecurityScheme'),
1018
+ NamedCorrelationIds: (0, _1.mapOf)('CorrelationId'),
1019
+ NamedStreamHeaders: (0, _1.mapOf)('StreamHeader'),
1020
1020
  ImplicitFlow,
1021
1021
  PasswordFlow,
1022
1022
  ClientCredentials,
@@ -1027,8 +1027,8 @@ exports.AsyncApi2Types = {
1027
1027
  MessageBindings,
1028
1028
  OperationBindings,
1029
1029
  OperationTrait,
1030
- OperationTraitList: _1.listOf('OperationTrait'),
1030
+ OperationTraitList: (0, _1.listOf)('OperationTrait'),
1031
1031
  MessageTrait,
1032
- MessageTraitList: _1.listOf('MessageTrait'),
1032
+ MessageTraitList: (0, _1.listOf)('MessageTrait'),
1033
1033
  CorrelationId,
1034
1034
  };
@@ -1,4 +1,4 @@
1
- export declare type ScalarSchema = {
1
+ export type ScalarSchema = {
2
2
  name?: never;
3
3
  type?: 'string' | 'boolean' | 'number' | 'integer' | 'object' | 'array';
4
4
  items?: ScalarSchema;
@@ -7,7 +7,7 @@ export declare type ScalarSchema = {
7
7
  directResolveAs?: string;
8
8
  minimum?: number;
9
9
  };
10
- export declare type NormalizedScalarSchema = {
10
+ export type NormalizedScalarSchema = {
11
11
  name?: never;
12
12
  type?: 'string' | 'boolean' | 'number' | 'integer' | 'object' | 'array';
13
13
  items?: ScalarSchema;
@@ -16,7 +16,7 @@ export declare type NormalizedScalarSchema = {
16
16
  resolvable: boolean;
17
17
  minimum?: number;
18
18
  };
19
- export declare type NodeType = {
19
+ export type NodeType = {
20
20
  properties: Record<string, PropType | ResolveTypeFn>;
21
21
  additionalProperties?: PropType | ResolveTypeFn;
22
22
  items?: string;
@@ -25,9 +25,9 @@ export declare type NodeType = {
25
25
  allowed?: (value: any) => string[] | undefined;
26
26
  extensionsPrefix?: string;
27
27
  };
28
- declare type PropType = string | NodeType | ScalarSchema | undefined | null;
29
- declare type ResolveTypeFn = (value: any, key: string) => string | PropType;
30
- export declare type NormalizedNodeType = {
28
+ type PropType = string | NodeType | ScalarSchema | undefined | null;
29
+ type ResolveTypeFn = (value: any, key: string) => string | PropType;
30
+ export type NormalizedNodeType = {
31
31
  name: string;
32
32
  properties: Record<string, NormalizedPropType | NormalizedResolveTypeFn>;
33
33
  additionalProperties?: NormalizedPropType | NormalizedResolveTypeFn;
@@ -37,8 +37,8 @@ export declare type NormalizedNodeType = {
37
37
  allowed?: (value: any) => string[] | undefined;
38
38
  extensionsPrefix?: string;
39
39
  };
40
- declare type NormalizedPropType = NormalizedNodeType | NormalizedScalarSchema | undefined | null;
41
- declare type NormalizedResolveTypeFn = (value: any, key: string) => NormalizedNodeType | NormalizedScalarSchema | undefined | null;
40
+ type NormalizedPropType = NormalizedNodeType | NormalizedScalarSchema | undefined | null;
41
+ type NormalizedResolveTypeFn = (value: any, key: string) => NormalizedNodeType | NormalizedScalarSchema | undefined | null;
42
42
  export declare function listOf(typeName: string): {
43
43
  name: string;
44
44
  properties: {};
package/lib/types/oas2.js CHANGED
@@ -212,7 +212,7 @@ const Response = {
212
212
  properties: {
213
213
  description: { type: 'string' },
214
214
  schema: 'Schema',
215
- headers: _1.mapOf('Header'),
215
+ headers: (0, _1.mapOf)('Header'),
216
216
  examples: 'Examples',
217
217
  'x-summary': { type: 'string' },
218
218
  },
@@ -298,13 +298,13 @@ const Schema = {
298
298
  },
299
299
  items: (value) => {
300
300
  if (Array.isArray(value)) {
301
- return _1.listOf('Schema');
301
+ return (0, _1.listOf)('Schema');
302
302
  }
303
303
  else {
304
304
  return 'Schema';
305
305
  }
306
306
  },
307
- allOf: _1.listOf('Schema'),
307
+ allOf: (0, _1.listOf)('Schema'),
308
308
  properties: 'SchemaProperties',
309
309
  additionalProperties: (value) => {
310
310
  if (typeof value === 'boolean') {
@@ -418,15 +418,15 @@ const Example = {
418
418
  exports.Oas2Types = {
419
419
  Root,
420
420
  Tag,
421
- TagList: _1.listOf('Tag'),
422
- TagGroups: _1.listOf('TagGroup'),
421
+ TagList: (0, _1.listOf)('Tag'),
422
+ TagGroups: (0, _1.listOf)('TagGroup'),
423
423
  TagGroup,
424
424
  ExternalDocs,
425
425
  Example,
426
- ExamplesMap: _1.mapOf('Example'),
426
+ ExamplesMap: (0, _1.mapOf)('Example'),
427
427
  EnumDescriptions,
428
428
  SecurityRequirement,
429
- SecurityRequirementList: _1.listOf('SecurityRequirement'),
429
+ SecurityRequirementList: (0, _1.listOf)('SecurityRequirement'),
430
430
  Info,
431
431
  Contact,
432
432
  License,
@@ -435,7 +435,7 @@ exports.Oas2Types = {
435
435
  PathItem,
436
436
  Parameter,
437
437
  ParameterItems,
438
- ParameterList: _1.listOf('Parameter'),
438
+ ParameterList: (0, _1.listOf)('Parameter'),
439
439
  Operation,
440
440
  Examples,
441
441
  Header,
@@ -444,13 +444,13 @@ exports.Oas2Types = {
444
444
  Schema,
445
445
  Xml,
446
446
  SchemaProperties,
447
- NamedSchemas: _1.mapOf('Schema'),
448
- NamedResponses: _1.mapOf('Response'),
449
- NamedParameters: _1.mapOf('Parameter'),
450
- NamedSecuritySchemes: _1.mapOf('SecurityScheme'),
447
+ NamedSchemas: (0, _1.mapOf)('Schema'),
448
+ NamedResponses: (0, _1.mapOf)('Response'),
449
+ NamedParameters: (0, _1.mapOf)('Parameter'),
450
+ NamedSecuritySchemes: (0, _1.mapOf)('SecurityScheme'),
451
451
  SecurityScheme,
452
452
  XCodeSample,
453
- XCodeSampleList: _1.listOf('XCodeSample'),
454
- XServerList: _1.listOf('XServer'),
453
+ XCodeSampleList: (0, _1.listOf)('XCodeSample'),
454
+ XServerList: (0, _1.listOf)('XServer'),
455
455
  XServer,
456
456
  };
package/lib/types/oas3.js CHANGED
@@ -303,14 +303,14 @@ const Schema = {
303
303
  type: {
304
304
  enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'],
305
305
  },
306
- allOf: _1.listOf('Schema'),
307
- anyOf: _1.listOf('Schema'),
308
- oneOf: _1.listOf('Schema'),
306
+ allOf: (0, _1.listOf)('Schema'),
307
+ anyOf: (0, _1.listOf)('Schema'),
308
+ oneOf: (0, _1.listOf)('Schema'),
309
309
  not: 'Schema',
310
310
  properties: 'SchemaProperties',
311
311
  items: (value) => {
312
312
  if (Array.isArray(value)) {
313
- return _1.listOf('Schema');
313
+ return (0, _1.listOf)('Schema');
314
314
  }
315
315
  else {
316
316
  return 'Schema';
@@ -364,7 +364,7 @@ const SchemaProperties = {
364
364
  const DiscriminatorMapping = {
365
365
  properties: {},
366
366
  additionalProperties: (value) => {
367
- if (ref_utils_1.isMappingRef(value)) {
367
+ if ((0, ref_utils_1.isMappingRef)(value)) {
368
368
  return { type: 'string', directResolveAs: 'Schema' };
369
369
  }
370
370
  else {
@@ -499,36 +499,36 @@ const XUsePkce = {
499
499
  exports.Oas3Types = {
500
500
  Root,
501
501
  Tag,
502
- TagList: _1.listOf('Tag'),
503
- TagGroups: _1.listOf('TagGroup'),
502
+ TagList: (0, _1.listOf)('Tag'),
503
+ TagGroups: (0, _1.listOf)('TagGroup'),
504
504
  TagGroup,
505
505
  ExternalDocs,
506
506
  Server,
507
- ServerList: _1.listOf('Server'),
507
+ ServerList: (0, _1.listOf)('Server'),
508
508
  ServerVariable,
509
- ServerVariablesMap: _1.mapOf('ServerVariable'),
509
+ ServerVariablesMap: (0, _1.mapOf)('ServerVariable'),
510
510
  SecurityRequirement,
511
- SecurityRequirementList: _1.listOf('SecurityRequirement'),
511
+ SecurityRequirementList: (0, _1.listOf)('SecurityRequirement'),
512
512
  Info,
513
513
  Contact,
514
514
  License,
515
515
  Paths,
516
516
  PathItem,
517
517
  Parameter,
518
- ParameterList: _1.listOf('Parameter'),
518
+ ParameterList: (0, _1.listOf)('Parameter'),
519
519
  Operation,
520
- Callback: _1.mapOf('PathItem'),
521
- CallbacksMap: _1.mapOf('Callback'),
520
+ Callback: (0, _1.mapOf)('PathItem'),
521
+ CallbacksMap: (0, _1.mapOf)('Callback'),
522
522
  RequestBody,
523
523
  MediaTypesMap,
524
524
  MediaType,
525
525
  Example,
526
- ExamplesMap: _1.mapOf('Example'),
526
+ ExamplesMap: (0, _1.mapOf)('Example'),
527
527
  Encoding,
528
- EncodingMap: _1.mapOf('Encoding'),
528
+ EncodingMap: (0, _1.mapOf)('Encoding'),
529
529
  EnumDescriptions,
530
530
  Header,
531
- HeadersMap: _1.mapOf('Header'),
531
+ HeadersMap: (0, _1.mapOf)('Header'),
532
532
  Responses,
533
533
  Response,
534
534
  Link,
@@ -539,16 +539,16 @@ exports.Oas3Types = {
539
539
  DiscriminatorMapping,
540
540
  Discriminator,
541
541
  Components,
542
- LinksMap: _1.mapOf('Link'),
543
- NamedSchemas: _1.mapOf('Schema'),
544
- NamedResponses: _1.mapOf('Response'),
545
- NamedParameters: _1.mapOf('Parameter'),
546
- NamedExamples: _1.mapOf('Example'),
547
- NamedRequestBodies: _1.mapOf('RequestBody'),
548
- NamedHeaders: _1.mapOf('Header'),
549
- NamedSecuritySchemes: _1.mapOf('SecurityScheme'),
550
- NamedLinks: _1.mapOf('Link'),
551
- NamedCallbacks: _1.mapOf('Callback'),
542
+ LinksMap: (0, _1.mapOf)('Link'),
543
+ NamedSchemas: (0, _1.mapOf)('Schema'),
544
+ NamedResponses: (0, _1.mapOf)('Response'),
545
+ NamedParameters: (0, _1.mapOf)('Parameter'),
546
+ NamedExamples: (0, _1.mapOf)('Example'),
547
+ NamedRequestBodies: (0, _1.mapOf)('RequestBody'),
548
+ NamedHeaders: (0, _1.mapOf)('Header'),
549
+ NamedSecuritySchemes: (0, _1.mapOf)('SecurityScheme'),
550
+ NamedLinks: (0, _1.mapOf)('Link'),
551
+ NamedCallbacks: (0, _1.mapOf)('Callback'),
552
552
  ImplicitFlow,
553
553
  PasswordFlow,
554
554
  ClientCredentials,
@@ -556,7 +556,7 @@ exports.Oas3Types = {
556
556
  OAuth2Flows,
557
557
  SecurityScheme,
558
558
  XCodeSample,
559
- XCodeSampleList: _1.listOf('XCodeSample'),
559
+ XCodeSampleList: (0, _1.listOf)('XCodeSample'),
560
560
  XUsePkce,
561
561
  WebhooksMap,
562
562
  };
@@ -121,15 +121,15 @@ const Schema = {
121
121
  };
122
122
  }
123
123
  },
124
- allOf: _1.listOf('Schema'),
125
- anyOf: _1.listOf('Schema'),
126
- oneOf: _1.listOf('Schema'),
124
+ allOf: (0, _1.listOf)('Schema'),
125
+ anyOf: (0, _1.listOf)('Schema'),
126
+ oneOf: (0, _1.listOf)('Schema'),
127
127
  not: 'Schema',
128
128
  if: 'Schema',
129
129
  then: 'Schema',
130
130
  else: 'Schema',
131
- dependentSchemas: _1.listOf('Schema'),
132
- prefixItems: _1.listOf('Schema'),
131
+ dependentSchemas: (0, _1.listOf)('Schema'),
132
+ prefixItems: (0, _1.listOf)('Schema'),
133
133
  contains: 'Schema',
134
134
  minContains: { type: 'integer', minimum: 0 },
135
135
  maxContains: { type: 'integer', minimum: 0 },
@@ -181,6 +181,17 @@ const Schema = {
181
181
  },
182
182
  extensionsPrefix: 'x-',
183
183
  };
184
+ const SchemaProperties = {
185
+ properties: {},
186
+ additionalProperties: (value) => {
187
+ if (typeof value === 'boolean') {
188
+ return { type: 'boolean' };
189
+ }
190
+ else {
191
+ return 'Schema';
192
+ }
193
+ },
194
+ };
184
195
  const SecurityScheme = {
185
196
  properties: {
186
197
  type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect', 'mutualTLS'] },
@@ -253,6 +264,7 @@ const SecurityScheme = {
253
264
  exports.Oas3_1Types = Object.assign(Object.assign({}, oas3_1.Oas3Types), { Info,
254
265
  Root,
255
266
  Schema,
267
+ SchemaProperties,
256
268
  License,
257
- Components, NamedPathItems: _1.mapOf('PathItem'), SecurityScheme,
269
+ Components, NamedPathItems: (0, _1.mapOf)('PathItem'), SecurityScheme,
258
270
  Operation });
@@ -1,2 +1,13 @@
1
1
  import { NodeType } from '.';
2
+ declare const builtInCommonRules: readonly ["spec", "info-contact", "operation-operationId", "tag-description", "tags-alphabetical"];
3
+ export type BuiltInCommonRuleId = typeof builtInCommonRules[number];
4
+ declare const builtInCommonOASRules: readonly ["info-license-url", "info-license", "no-ambiguous-paths", "no-enum-type-mismatch", "no-http-verbs-in-paths", "no-identical-paths", "no-invalid-parameter-examples", "no-invalid-schema-examples", "no-path-trailing-slash", "operation-2xx-response", "operation-4xx-response", "operation-description", "operation-operationId-unique", "operation-operationId-url-safe", "operation-parameters-unique", "operation-singular-tag", "operation-summary", "operation-tag-defined", "parameter-description", "path-declaration-must-exist", "path-excludes-patterns", "path-http-verbs-order", "path-not-include-query", "path-params-defined", "path-parameters-defined", "path-segment-plural", "paths-kebab-case", "required-string-property-missing-min-length", "response-contains-header", "scalar-property-missing-example", "security-defined", "spec-strict-refs", "no-unresolved-refs"];
5
+ export type BuiltInCommonOASRuleId = typeof builtInCommonOASRules[number];
6
+ declare const builtInOAS2Rules: readonly ["boolean-parameter-prefixes", "request-mime-type", "response-contains-property", "response-mime-type"];
7
+ export type BuiltInOAS2RuleId = typeof builtInOAS2Rules[number];
8
+ declare const builtInOAS3Rules: readonly ["boolean-parameter-prefixes", "component-name-unique", "no-empty-servers", "no-example-value-and-externalValue", "no-invalid-media-type-examples", "no-server-example.com", "no-server-trailing-slash", "no-server-variables-empty-enum", "no-undefined-server-variable", "no-unused-components", "operation-4xx-problem-details-rfc7807", "request-mime-type", "response-contains-property", "response-mime-type", "spec-components-invalid-map-name"];
9
+ export type BuiltInOAS3RuleId = typeof builtInOAS3Rules[number];
10
+ declare const builtInAsync2Rules: readonly ["channels-kebab-case", "no-channel-trailing-slash"];
11
+ export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
2
12
  export declare const ConfigTypes: Record<string, NodeType>;
13
+ export {};