@redocly/openapi-core 1.0.0-beta.108 → 1.0.0-beta.109

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 (132) hide show
  1. package/lib/benchmark/benches/resolve-with-no-external.bench.js +1 -1
  2. package/lib/bundle.d.ts +1 -1
  3. package/lib/bundle.js +4 -4
  4. package/lib/config/all.js +3 -1
  5. package/lib/config/config-resolvers.js +1 -1
  6. package/lib/config/minimal.js +3 -1
  7. package/lib/config/recommended.js +3 -1
  8. package/lib/config/rules.js +1 -1
  9. package/lib/config/types.d.ts +7 -0
  10. package/lib/config/utils.d.ts +2 -2
  11. package/lib/config/utils.js +42 -4
  12. package/lib/decorators/common/registry-dependencies.js +1 -1
  13. package/lib/format/format.d.ts +1 -1
  14. package/lib/format/format.js +22 -1
  15. package/lib/lint.js +2 -2
  16. package/lib/redocly/registry-api.d.ts +0 -1
  17. package/lib/redocly/registry-api.js +5 -4
  18. package/lib/resolve.js +3 -1
  19. package/lib/rules/common/no-ambiguous-paths.js +1 -1
  20. package/lib/rules/common/no-identical-paths.js +1 -1
  21. package/lib/rules/common/operation-2xx-response.js +1 -1
  22. package/lib/rules/common/operation-4xx-response.js +1 -1
  23. package/lib/rules/common/operation-operationId.js +1 -1
  24. package/lib/rules/common/operation-tag-defined.js +1 -1
  25. package/lib/rules/common/path-not-include-query.js +1 -1
  26. package/lib/rules/common/security-defined.d.ts +2 -0
  27. package/lib/rules/common/{operation-security-defined.js → security-defined.js} +18 -4
  28. package/lib/rules/common/spec.js +12 -1
  29. package/lib/rules/common/tags-alphabetical.js +1 -1
  30. package/lib/rules/oas2/index.d.ts +1 -1
  31. package/lib/rules/oas2/index.js +2 -2
  32. package/lib/rules/oas2/remove-unused-components.js +1 -1
  33. package/lib/rules/oas2/request-mime-type.js +1 -1
  34. package/lib/rules/oas2/response-mime-type.js +1 -1
  35. package/lib/rules/oas3/index.js +6 -2
  36. package/lib/rules/oas3/no-empty-servers.js +1 -1
  37. package/lib/rules/oas3/no-server-variables-empty-enum.js +1 -1
  38. package/lib/rules/oas3/no-unused-components.js +1 -1
  39. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts +5 -0
  40. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +36 -0
  41. package/lib/rules/oas3/remove-unused-components.js +1 -1
  42. package/lib/rules/oas3/request-mime-type.js +1 -1
  43. package/lib/rules/oas3/response-mime-type.js +1 -1
  44. package/lib/rules/oas3/spec-components-invalid-map-name.d.ts +2 -0
  45. package/lib/rules/oas3/spec-components-invalid-map-name.js +46 -0
  46. package/lib/rules/other/stats.d.ts +2 -2
  47. package/lib/rules/other/stats.js +2 -2
  48. package/lib/types/oas2.js +5 -5
  49. package/lib/types/oas3.js +27 -20
  50. package/lib/types/oas3_1.js +3 -3
  51. package/lib/types/redocly-yaml.js +46 -55
  52. package/lib/utils.d.ts +3 -3
  53. package/lib/utils.js +5 -5
  54. package/lib/visitors.d.ts +11 -11
  55. package/lib/visitors.js +13 -1
  56. package/package.json +1 -1
  57. package/src/__tests__/__snapshots__/bundle.test.ts.snap +3 -3
  58. package/src/__tests__/fixtures/extension.js +3 -3
  59. package/src/__tests__/format.test.ts +76 -0
  60. package/src/__tests__/lint.test.ts +106 -131
  61. package/src/__tests__/resolve-http.test.ts +1 -1
  62. package/src/__tests__/resolve.test.ts +9 -9
  63. package/src/__tests__/walk.test.ts +78 -10
  64. package/src/benchmark/benches/resolve-with-no-external.bench.ts +1 -1
  65. package/src/bundle.ts +4 -4
  66. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +6 -2
  67. package/src/config/__tests__/fixtures/plugin-config.yaml +2 -3
  68. package/src/config/__tests__/fixtures/resolve-config/api/nested-config.yaml +11 -12
  69. package/src/config/__tests__/fixtures/resolve-config/local-config-with-circular.yaml +7 -8
  70. package/src/config/__tests__/fixtures/resolve-config/local-config-with-file.yaml +18 -19
  71. package/src/config/__tests__/fixtures/resolve-config/local-config.yaml +9 -10
  72. package/src/config/__tests__/fixtures/resolve-remote-configs/nested-remote-config.yaml +3 -4
  73. package/src/config/__tests__/fixtures/resolve-remote-configs/remote-config.yaml +4 -5
  74. package/src/config/__tests__/load.test.ts +12 -15
  75. package/src/config/__tests__/utils.test.ts +64 -4
  76. package/src/config/all.ts +3 -1
  77. package/src/config/config-resolvers.ts +2 -2
  78. package/src/config/load.ts +3 -2
  79. package/src/config/minimal.ts +3 -1
  80. package/src/config/recommended.ts +3 -1
  81. package/src/config/rules.ts +2 -2
  82. package/src/config/types.ts +11 -0
  83. package/src/config/utils.ts +102 -13
  84. package/src/decorators/common/registry-dependencies.ts +1 -1
  85. package/src/format/format.ts +32 -2
  86. package/src/lint.ts +2 -2
  87. package/src/redocly/registry-api.ts +5 -4
  88. package/src/resolve.ts +3 -1
  89. package/src/rules/__tests__/utils.test.ts +1 -1
  90. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +1 -0
  91. package/src/rules/common/__tests__/operation-2xx-response.test.ts +1 -1
  92. package/src/rules/common/__tests__/operation-4xx-response.test.ts +26 -3
  93. package/src/rules/common/__tests__/security-defined.test.ts +175 -0
  94. package/src/rules/common/__tests__/spec.test.ts +79 -0
  95. package/src/rules/common/assertions/__tests__/utils.test.ts +2 -2
  96. package/src/rules/common/no-ambiguous-paths.ts +1 -1
  97. package/src/rules/common/no-identical-paths.ts +1 -1
  98. package/src/rules/common/operation-2xx-response.ts +1 -1
  99. package/src/rules/common/operation-4xx-response.ts +1 -1
  100. package/src/rules/common/operation-operationId.ts +1 -1
  101. package/src/rules/common/operation-tag-defined.ts +1 -1
  102. package/src/rules/common/path-not-include-query.ts +1 -1
  103. package/src/rules/common/{operation-security-defined.ts → security-defined.ts} +19 -4
  104. package/src/rules/common/spec.ts +15 -1
  105. package/src/rules/common/tags-alphabetical.ts +1 -1
  106. package/src/rules/oas2/index.ts +2 -2
  107. package/src/rules/oas2/remove-unused-components.ts +1 -1
  108. package/src/rules/oas2/request-mime-type.ts +1 -1
  109. package/src/rules/oas2/response-mime-type.ts +1 -1
  110. package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +145 -0
  111. package/src/rules/oas3/__tests__/spec/spec.test.ts +10 -0
  112. package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +217 -0
  113. package/src/rules/oas3/index.ts +6 -2
  114. package/src/rules/oas3/no-empty-servers.ts +1 -1
  115. package/src/rules/oas3/no-server-variables-empty-enum.ts +1 -1
  116. package/src/rules/oas3/no-unused-components.ts +1 -1
  117. package/src/rules/oas3/operation-4xx-problem-details-rfc7807.ts +36 -0
  118. package/src/rules/oas3/remove-unused-components.ts +1 -1
  119. package/src/rules/oas3/request-mime-type.ts +1 -1
  120. package/src/rules/oas3/response-mime-type.ts +1 -1
  121. package/src/rules/oas3/spec-components-invalid-map-name.ts +53 -0
  122. package/src/rules/other/stats.ts +2 -2
  123. package/src/types/index.ts +2 -2
  124. package/src/types/oas2.ts +5 -5
  125. package/src/types/oas3.ts +27 -20
  126. package/src/types/oas3_1.ts +3 -3
  127. package/src/types/redocly-yaml.ts +52 -40
  128. package/src/utils.ts +11 -7
  129. package/src/visitors.ts +29 -13
  130. package/tsconfig.tsbuildinfo +1 -1
  131. package/lib/rules/common/operation-security-defined.d.ts +0 -2
  132. package/src/rules/common/__tests__/operation-security-defined.test.ts +0 -69
@@ -26,7 +26,7 @@ const RemoveUnusedComponents = () => {
26
26
  }
27
27
  },
28
28
  },
29
- DefinitionRoot: {
29
+ Root: {
30
30
  leave(root, ctx) {
31
31
  const data = ctx.getVisitorData();
32
32
  data.removedCount = 0;
@@ -4,7 +4,7 @@ exports.RequestMimeType = void 0;
4
4
  const utils_1 = require("../../utils");
5
5
  const RequestMimeType = ({ allowedValues }) => {
6
6
  return {
7
- DefinitionRoot(root, ctx) {
7
+ Root(root, ctx) {
8
8
  utils_1.validateMimeType({ type: 'consumes', value: root }, ctx, allowedValues);
9
9
  },
10
10
  Operation: {
@@ -4,7 +4,7 @@ exports.ResponseMimeType = void 0;
4
4
  const utils_1 = require("../../utils");
5
5
  const ResponseMimeType = ({ allowedValues }) => {
6
6
  return {
7
- DefinitionRoot(root, ctx) {
7
+ Root(root, ctx) {
8
8
  utils_1.validateMimeType({ type: 'produces', value: root }, ctx, allowedValues);
9
9
  },
10
10
  Operation: {
@@ -27,7 +27,7 @@ const no_unused_components_1 = require("./no-unused-components");
27
27
  const path_not_include_query_1 = require("../common/path-not-include-query");
28
28
  const parameter_description_1 = require("../common/parameter-description");
29
29
  const operation_singular_tag_1 = require("../common/operation-singular-tag");
30
- const operation_security_defined_1 = require("../common/operation-security-defined");
30
+ const security_defined_1 = require("../common/security-defined");
31
31
  const no_unresolved_refs_1 = require("../no-unresolved-refs");
32
32
  const boolean_parameter_prefixes_1 = require("./boolean-parameter-prefixes");
33
33
  const paths_kebab_case_1 = require("../common/paths-kebab-case");
@@ -50,6 +50,8 @@ const no_invalid_parameter_examples_1 = require("../common/no-invalid-parameter-
50
50
  const response_contains_header_1 = require("../common/response-contains-header");
51
51
  const response_contains_property_1 = require("./response-contains-property");
52
52
  const scalar_property_missing_example_1 = require("../common/scalar-property-missing-example");
53
+ const spec_components_invalid_map_name_1 = require("./spec-components-invalid-map-name");
54
+ const operation_4xx_problem_details_rfc7807_1 = require("./operation-4xx-problem-details-rfc7807");
53
55
  exports.rules = {
54
56
  spec: spec_1.OasSpec,
55
57
  'info-description': info_description_1.InfoDescription,
@@ -58,6 +60,7 @@ exports.rules = {
58
60
  'info-license-url': info_license_url_1.InfoLicenseUrl,
59
61
  'operation-2xx-response': operation_2xx_response_1.Operation2xxResponse,
60
62
  'operation-4xx-response': operation_4xx_response_1.Operation4xxResponse,
63
+ 'operation-4xx-problem-details-rfc7807': operation_4xx_problem_details_rfc7807_1.Operation4xxProblemDetailsRfc7807,
61
64
  assertions: assertions_1.Assertions,
62
65
  'operation-operationId-unique': operation_operationId_unique_1.OperationIdUnique,
63
66
  'operation-parameters-unique': operation_parameters_unique_1.OperationParametersUnique,
@@ -81,7 +84,7 @@ exports.rules = {
81
84
  'path-params-defined': path_params_defined_1.PathParamsDefined,
82
85
  'parameter-description': parameter_description_1.ParameterDescription,
83
86
  'operation-singular-tag': operation_singular_tag_1.OperationSingularTag,
84
- 'operation-security-defined': operation_security_defined_1.OperationSecurityDefined,
87
+ 'security-defined': security_defined_1.SecurityDefined,
85
88
  'no-unresolved-refs': no_unresolved_refs_1.NoUnresolvedRefs,
86
89
  'paths-kebab-case': paths_kebab_case_1.PathsKebabCase,
87
90
  'boolean-parameter-prefixes': boolean_parameter_prefixes_1.BooleanParameterPrefixes,
@@ -101,5 +104,6 @@ exports.rules = {
101
104
  'response-contains-header': response_contains_header_1.ResponseContainsHeader,
102
105
  'response-contains-property': response_contains_property_1.ResponseContainsProperty,
103
106
  'scalar-property-missing-example': scalar_property_missing_example_1.ScalarPropertyMissingExample,
107
+ 'spec-components-invalid-map-name': spec_components_invalid_map_name_1.SpecComponentsInvalidMapName,
104
108
  };
105
109
  exports.preprocessors = {};
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NoEmptyServers = void 0;
4
4
  const NoEmptyServers = () => {
5
5
  return {
6
- DefinitionRoot(root, { report, location }) {
6
+ Root(root, { report, location }) {
7
7
  if (!root.hasOwnProperty('servers')) {
8
8
  report({
9
9
  message: 'Servers must be present.',
@@ -8,7 +8,7 @@ var enumError;
8
8
  })(enumError || (enumError = {}));
9
9
  const NoServerVariablesEmptyEnum = () => {
10
10
  return {
11
- DefinitionRoot(root, { report, location }) {
11
+ Root(root, { report, location }) {
12
12
  if (!root.servers || root.servers.length === 0)
13
13
  return;
14
14
  const invalidVariables = [];
@@ -24,7 +24,7 @@ const NoUnusedComponents = () => {
24
24
  });
25
25
  }
26
26
  },
27
- DefinitionRoot: {
27
+ Root: {
28
28
  leave(_, { report }) {
29
29
  components.forEach((usageInfo) => {
30
30
  if (!usageInfo.used) {
@@ -0,0 +1,5 @@
1
+ import { Oas3Rule } from '../../visitors';
2
+ /**
3
+ * Validation according rfc7807 - https://datatracker.ietf.org/doc/html/rfc7807
4
+ */
5
+ export declare const Operation4xxProblemDetailsRfc7807: Oas3Rule;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Operation4xxProblemDetailsRfc7807 = void 0;
4
+ const utils_1 = require("../utils");
5
+ /**
6
+ * Validation according rfc7807 - https://datatracker.ietf.org/doc/html/rfc7807
7
+ */
8
+ const Operation4xxProblemDetailsRfc7807 = () => {
9
+ return {
10
+ Response: {
11
+ skip(_response, key) {
12
+ return !/4[Xx0-9]{2}/.test(`${key}`);
13
+ },
14
+ enter(response, { report, location }) {
15
+ if (!response.content || !response.content['application/problem+json'])
16
+ report({
17
+ message: 'Response `4xx` must have content-type `application/problem+json`.',
18
+ location: location.key(),
19
+ });
20
+ },
21
+ MediaType: {
22
+ skip(_response, key) {
23
+ return key !== 'application/problem+json';
24
+ },
25
+ enter(media, ctx) {
26
+ utils_1.validateDefinedAndNonEmpty('schema', media, ctx);
27
+ },
28
+ SchemaProperties(schema, ctx) {
29
+ utils_1.validateDefinedAndNonEmpty('type', schema, ctx);
30
+ utils_1.validateDefinedAndNonEmpty('title', schema, ctx);
31
+ },
32
+ },
33
+ },
34
+ };
35
+ };
36
+ exports.Operation4xxProblemDetailsRfc7807 = Operation4xxProblemDetailsRfc7807;
@@ -26,7 +26,7 @@ const RemoveUnusedComponents = () => {
26
26
  }
27
27
  },
28
28
  },
29
- DefinitionRoot: {
29
+ Root: {
30
30
  leave(root, ctx) {
31
31
  const data = ctx.getVisitorData();
32
32
  data.removedCount = 0;
@@ -4,7 +4,7 @@ exports.RequestMimeType = void 0;
4
4
  const utils_1 = require("../../utils");
5
5
  const RequestMimeType = ({ allowedValues }) => {
6
6
  return {
7
- PathMap: {
7
+ PathsMap: {
8
8
  RequestBody: {
9
9
  leave(requestBody, ctx) {
10
10
  utils_1.validateMimeTypeOAS3({ type: 'consumes', value: requestBody }, ctx, allowedValues);
@@ -4,7 +4,7 @@ exports.ResponseMimeType = void 0;
4
4
  const utils_1 = require("../../utils");
5
5
  const ResponseMimeType = ({ allowedValues }) => {
6
6
  return {
7
- PathMap: {
7
+ PathsMap: {
8
8
  Response: {
9
9
  leave(response, ctx) {
10
10
  utils_1.validateMimeTypeOAS3({ type: 'produces', value: response }, ctx, allowedValues);
@@ -0,0 +1,2 @@
1
+ import { Oas3Rule } from '../../visitors';
2
+ export declare const SpecComponentsInvalidMapName: Oas3Rule;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpecComponentsInvalidMapName = void 0;
4
+ const SpecComponentsInvalidMapName = () => {
5
+ const KEYS_REGEX = '^[a-zA-Z0-9\\.\\-_]+$';
6
+ function validateKey(key, report, location, component) {
7
+ if (!new RegExp(KEYS_REGEX).test(key)) {
8
+ report({
9
+ message: `The map key in ${component} "${key}" does not match the regular expression "${KEYS_REGEX}"`,
10
+ location: location.key(),
11
+ });
12
+ }
13
+ }
14
+ return {
15
+ Components: {
16
+ Parameter(_node, { key, report, location }) {
17
+ validateKey(key, report, location, 'parameters');
18
+ },
19
+ Response(_node, { key, report, location }) {
20
+ validateKey(key, report, location, 'responses');
21
+ },
22
+ Schema(_node, { key, report, location }) {
23
+ validateKey(key, report, location, 'schemas');
24
+ },
25
+ Example(_node, { key, report, location }) {
26
+ validateKey(key, report, location, 'examples');
27
+ },
28
+ RequestBody(_node, { key, report, location }) {
29
+ validateKey(key, report, location, 'requestBodies');
30
+ },
31
+ Header(_node, { key, report, location }) {
32
+ validateKey(key, report, location, 'headers');
33
+ },
34
+ SecurityScheme(_node, { key, report, location }) {
35
+ validateKey(key, report, location, 'securitySchemas');
36
+ },
37
+ Link(_node, { key, report, location }) {
38
+ validateKey(key, report, location, 'links');
39
+ },
40
+ Callback(_node, { key, report, location }) {
41
+ validateKey(key, report, location, 'callbacks');
42
+ },
43
+ },
44
+ };
45
+ };
46
+ exports.SpecComponentsInvalidMapName = SpecComponentsInvalidMapName;
@@ -14,7 +14,7 @@ export declare const Stats: (statsAccumulator: StatsAccumulator) => {
14
14
  Link: {
15
15
  leave(link: any): void;
16
16
  };
17
- DefinitionRoot: {
17
+ Root: {
18
18
  leave(): void;
19
19
  };
20
20
  WebhooksMap: {
@@ -22,7 +22,7 @@ export declare const Stats: (statsAccumulator: StatsAccumulator) => {
22
22
  leave(operation: any): void;
23
23
  };
24
24
  };
25
- PathMap: {
25
+ PathsMap: {
26
26
  PathItem: {
27
27
  leave(): void;
28
28
  Operation: {
@@ -23,7 +23,7 @@ const Stats = (statsAccumulator) => {
23
23
  statsAccumulator.links.items.add(link.operationId);
24
24
  },
25
25
  },
26
- DefinitionRoot: {
26
+ Root: {
27
27
  leave() {
28
28
  statsAccumulator.parameters.total = statsAccumulator.parameters.items.size;
29
29
  statsAccumulator.refs.total = statsAccumulator.refs.items.size;
@@ -40,7 +40,7 @@ const Stats = (statsAccumulator) => {
40
40
  },
41
41
  },
42
42
  },
43
- PathMap: {
43
+ PathsMap: {
44
44
  PathItem: {
45
45
  leave() {
46
46
  statsAccumulator.pathItems.total++;
package/lib/types/oas2.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Oas2Types = void 0;
4
4
  const _1 = require(".");
5
5
  const responseCodeRegexp = /^[0-9][0-9Xx]{2}$/;
6
- const DefinitionRoot = {
6
+ const Root = {
7
7
  properties: {
8
8
  swagger: { type: 'string' },
9
9
  info: 'Info',
@@ -12,7 +12,7 @@ const DefinitionRoot = {
12
12
  schemes: { type: 'array', items: { type: 'string' } },
13
13
  consumes: { type: 'array', items: { type: 'string' } },
14
14
  produces: { type: 'array', items: { type: 'string' } },
15
- paths: 'PathMap',
15
+ paths: 'PathsMap',
16
16
  definitions: 'NamedSchemas',
17
17
  parameters: 'NamedParameters',
18
18
  responses: 'NamedResponses',
@@ -48,7 +48,7 @@ const License = {
48
48
  },
49
49
  required: ['name'],
50
50
  };
51
- const PathMap = {
51
+ const PathsMap = {
52
52
  properties: {},
53
53
  additionalProperties: (_value, key) => key.startsWith('/') ? 'PathItem' : undefined,
54
54
  };
@@ -352,14 +352,14 @@ const SecurityRequirement = {
352
352
  additionalProperties: { type: 'array', items: { type: 'string' } },
353
353
  };
354
354
  exports.Oas2Types = {
355
- DefinitionRoot,
355
+ Root,
356
356
  Tag,
357
357
  ExternalDocs,
358
358
  SecurityRequirement,
359
359
  Info,
360
360
  Contact,
361
361
  License,
362
- PathMap,
362
+ PathsMap,
363
363
  PathItem,
364
364
  Parameter,
365
365
  ParameterItems,
package/lib/types/oas3.js CHANGED
@@ -4,7 +4,7 @@ exports.Oas3Types = void 0;
4
4
  const _1 = require(".");
5
5
  const ref_utils_1 = require("../ref-utils");
6
6
  const responseCodeRegexp = /^[0-9][0-9Xx]{2}$/;
7
- const DefinitionRoot = {
7
+ const Root = {
8
8
  properties: {
9
9
  openapi: null,
10
10
  info: 'Info',
@@ -12,7 +12,7 @@ const DefinitionRoot = {
12
12
  security: _1.listOf('SecurityRequirement'),
13
13
  tags: _1.listOf('Tag'),
14
14
  externalDocs: 'ExternalDocs',
15
- paths: 'PathMap',
15
+ paths: 'PathsMap',
16
16
  components: 'Components',
17
17
  'x-webhooks': 'WebhooksMap',
18
18
  },
@@ -37,7 +37,7 @@ const Server = {
37
37
  properties: {
38
38
  url: { type: 'string' },
39
39
  description: { type: 'string' },
40
- variables: _1.mapOf('ServerVariable'),
40
+ variables: 'ServerVariablesMap',
41
41
  },
42
42
  required: ['url'],
43
43
  };
@@ -81,7 +81,7 @@ const License = {
81
81
  },
82
82
  required: ['name'],
83
83
  };
84
- const PathMap = {
84
+ const PathsMap = {
85
85
  properties: {},
86
86
  additionalProperties: (_value, key) => key.startsWith('/') ? 'PathItem' : undefined,
87
87
  };
@@ -121,8 +121,8 @@ const Parameter = {
121
121
  allowReserved: { type: 'boolean' },
122
122
  schema: 'Schema',
123
123
  example: { isExample: true },
124
- examples: _1.mapOf('Example'),
125
- content: 'MediaTypeMap',
124
+ examples: 'ExamplesMap',
125
+ content: 'MediaTypesMap',
126
126
  },
127
127
  required: ['name', 'in'],
128
128
  requiredOneOf: ['schema', 'content'],
@@ -143,7 +143,7 @@ const Operation = {
143
143
  requestBody: 'RequestBody',
144
144
  responses: 'ResponsesMap',
145
145
  deprecated: { type: 'boolean' },
146
- callbacks: _1.mapOf('Callback'),
146
+ callbacks: 'CallbacksMap',
147
147
  'x-codeSamples': _1.listOf('XCodeSample'),
148
148
  'x-code-samples': _1.listOf('XCodeSample'),
149
149
  'x-hideTryItPanel': { type: 'boolean' },
@@ -161,11 +161,11 @@ const RequestBody = {
161
161
  properties: {
162
162
  description: { type: 'string' },
163
163
  required: { type: 'boolean' },
164
- content: 'MediaTypeMap',
164
+ content: 'MediaTypesMap',
165
165
  },
166
166
  required: ['content'],
167
167
  };
168
- const MediaTypeMap = {
168
+ const MediaTypesMap = {
169
169
  properties: {},
170
170
  additionalProperties: 'MediaType',
171
171
  };
@@ -173,8 +173,8 @@ const MediaType = {
173
173
  properties: {
174
174
  schema: 'Schema',
175
175
  example: { isExample: true },
176
- examples: _1.mapOf('Example'),
177
- encoding: _1.mapOf('Encoding'),
176
+ examples: 'ExamplesMap',
177
+ encoding: 'EncodingsMap',
178
178
  },
179
179
  };
180
180
  const Example = {
@@ -188,7 +188,7 @@ const Example = {
188
188
  const Encoding = {
189
189
  properties: {
190
190
  contentType: { type: 'string' },
191
- headers: _1.mapOf('Header'),
191
+ headers: 'HeadersMap',
192
192
  style: {
193
193
  enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
194
194
  },
@@ -209,9 +209,10 @@ const Header = {
209
209
  allowReserved: { type: 'boolean' },
210
210
  schema: 'Schema',
211
211
  example: { isExample: true },
212
- examples: _1.mapOf('Example'),
213
- content: 'MediaTypeMap',
212
+ examples: 'ExamplesMap',
213
+ content: 'MediaTypesMap',
214
214
  },
215
+ requiredOneOf: ['schema', 'content'],
215
216
  };
216
217
  const ResponsesMap = {
217
218
  properties: { default: 'Response' },
@@ -220,9 +221,9 @@ const ResponsesMap = {
220
221
  const Response = {
221
222
  properties: {
222
223
  description: { type: 'string' },
223
- headers: _1.mapOf('Header'),
224
- content: 'MediaTypeMap',
225
- links: _1.mapOf('Link'),
224
+ headers: 'HeadersMap',
225
+ content: 'MediaTypesMap',
226
+ links: 'LinksMap',
226
227
  },
227
228
  required: ['description'],
228
229
  };
@@ -427,26 +428,31 @@ const SecurityScheme = {
427
428
  extensionsPrefix: 'x-',
428
429
  };
429
430
  exports.Oas3Types = {
430
- DefinitionRoot,
431
+ Root,
431
432
  Tag,
432
433
  ExternalDocs,
433
434
  Server,
434
435
  ServerVariable,
436
+ ServerVariablesMap: _1.mapOf('ServerVariable'),
435
437
  SecurityRequirement,
436
438
  Info,
437
439
  Contact,
438
440
  License,
439
- PathMap,
441
+ PathsMap,
440
442
  PathItem,
441
443
  Parameter,
442
444
  Operation,
443
445
  Callback: _1.mapOf('PathItem'),
446
+ CallbacksMap: _1.mapOf('Callback'),
444
447
  RequestBody,
445
- MediaTypeMap,
448
+ MediaTypesMap,
446
449
  MediaType,
447
450
  Example,
451
+ ExamplesMap: _1.mapOf('Example'),
448
452
  Encoding,
453
+ EncodingsMap: _1.mapOf('Encoding'),
449
454
  Header,
455
+ HeadersMap: _1.mapOf('Header'),
450
456
  ResponsesMap,
451
457
  Response,
452
458
  Link,
@@ -456,6 +462,7 @@ exports.Oas3Types = {
456
462
  DiscriminatorMapping,
457
463
  Discriminator,
458
464
  Components,
465
+ LinksMap: _1.mapOf('Link'),
459
466
  NamedSchemas: _1.mapOf('Schema'),
460
467
  NamedResponses: _1.mapOf('Response'),
461
468
  NamedParameters: _1.mapOf('Parameter'),
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Oas3_1Types = void 0;
4
4
  const _1 = require(".");
5
5
  const oas3_1 = require("./oas3");
6
- const DefinitionRoot = {
6
+ const Root = {
7
7
  properties: {
8
8
  openapi: null,
9
9
  info: 'Info',
@@ -11,7 +11,7 @@ const DefinitionRoot = {
11
11
  security: _1.listOf('SecurityRequirement'),
12
12
  tags: _1.listOf('Tag'),
13
13
  externalDocs: 'ExternalDocs',
14
- paths: 'PathMap',
14
+ paths: 'PathsMap',
15
15
  webhooks: 'WebhooksMap',
16
16
  components: 'Components',
17
17
  jsonSchemaDialect: { type: 'string' },
@@ -237,7 +237,7 @@ const SecurityScheme = {
237
237
  extensionsPrefix: 'x-',
238
238
  };
239
239
  exports.Oas3_1Types = Object.assign(Object.assign({}, oas3_1.Oas3Types), { Info,
240
- DefinitionRoot,
240
+ Root,
241
241
  Schema,
242
242
  License,
243
243
  Components, NamedPathItems: _1.mapOf('PathItem'), SecurityScheme,
@@ -11,6 +11,7 @@ const builtInRulesList = [
11
11
  'info-license-url',
12
12
  'operation-2xx-response',
13
13
  'operation-4xx-response',
14
+ 'operation-4xx-problem-details-rfc7807',
14
15
  'assertions',
15
16
  'operation-operationId-unique',
16
17
  'operation-parameters-unique',
@@ -34,7 +35,7 @@ const builtInRulesList = [
34
35
  'path-params-defined',
35
36
  'parameter-description',
36
37
  'operation-singular-tag',
37
- 'operation-security-defined',
38
+ 'security-defined',
38
39
  'no-unresolved-refs',
39
40
  'paths-kebab-case',
40
41
  'boolean-parameter-prefixes',
@@ -54,31 +55,38 @@ const builtInRulesList = [
54
55
  'response-contains-header',
55
56
  'response-contains-property',
56
57
  'scalar-property-missing-example',
58
+ 'spec-components-invalid-map-name',
57
59
  ];
58
60
  const nodeTypesList = [
59
- 'DefinitionRoot',
61
+ 'Root',
60
62
  'Tag',
61
63
  'ExternalDocs',
62
64
  'Server',
63
65
  'ServerVariable',
66
+ 'ServerVariablesMap',
64
67
  'SecurityRequirement',
65
68
  'Info',
66
69
  'Contact',
67
70
  'License',
68
- 'PathMap',
71
+ 'PathsMap',
69
72
  'PathItem',
70
73
  'Parameter',
71
74
  'Operation',
72
75
  'Callback',
76
+ 'CallbacksMap',
73
77
  'RequestBody',
74
- 'MediaTypeMap',
78
+ 'MediaTypesMap',
75
79
  'MediaType',
76
80
  'Example',
81
+ 'ExamplesMap',
77
82
  'Encoding',
83
+ 'EncodingsMap',
78
84
  'Header',
85
+ 'HeadersMap',
79
86
  'ResponsesMap',
80
87
  'Response',
81
88
  'Link',
89
+ 'LinksMap',
82
90
  'Schema',
83
91
  'Xml',
84
92
  'SchemaProperties',
@@ -103,45 +111,57 @@ const nodeTypesList = [
103
111
  'XCodeSample',
104
112
  'WebhooksMap',
105
113
  ];
106
- const ConfigRoot = {
114
+ const ConfigStyleguide = {
107
115
  properties: {
108
- organization: { type: 'string' },
109
- apis: 'ConfigApis',
110
- apiDefinitions: {
116
+ extends: {
117
+ type: 'array',
118
+ items: {
119
+ type: 'string',
120
+ },
121
+ },
122
+ rules: 'Rules',
123
+ oas2Rules: 'Rules',
124
+ oas3_0Rules: 'Rules',
125
+ oas3_1Rules: 'Rules',
126
+ preprocessors: { type: 'object' },
127
+ oas2Preprocessors: { type: 'object' },
128
+ oas3_0Preprocessors: { type: 'object' },
129
+ oas3_1Preprocessors: { type: 'object' },
130
+ decorators: { type: 'object' },
131
+ oas2Decorators: { type: 'object' },
132
+ oas3_0Decorators: { type: 'object' },
133
+ oas3_1Decorators: { type: 'object' },
134
+ },
135
+ };
136
+ const RootConfigStyleguide = {
137
+ properties: Object.assign({ plugins: {
138
+ type: 'array',
139
+ items: { type: 'string' },
140
+ } }, ConfigStyleguide.properties),
141
+ };
142
+ const ConfigRoot = {
143
+ properties: Object.assign(Object.assign({ organization: { type: 'string' }, apis: 'ConfigApis', apiDefinitions: {
111
144
  type: 'object',
112
145
  properties: {},
113
146
  additionalProperties: { properties: { type: 'string' } },
114
- },
115
- styleguide: 'RootConfigStyleguide',
116
- lint: 'RootConfigStyleguide',
117
- 'features.openapi': 'ConfigReferenceDocs',
118
- referenceDocs: 'ConfigReferenceDocs',
119
- 'features.mockServer': 'ConfigMockServer',
120
- region: { enum: ['us', 'eu'] },
121
- resolve: {
147
+ } }, RootConfigStyleguide.properties), { styleguide: 'RootConfigStyleguide', lint: 'RootConfigStyleguide', 'features.openapi': 'ConfigReferenceDocs', referenceDocs: 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer', region: { enum: ['us', 'eu'] }, resolve: {
122
148
  properties: {
123
149
  http: 'ConfigHTTP',
150
+ doNotResolveExamples: { type: 'boolean' },
124
151
  },
125
- },
126
- },
152
+ } }),
127
153
  };
128
154
  const ConfigApis = {
129
155
  properties: {},
130
156
  additionalProperties: 'ConfigApisProperties',
131
157
  };
132
158
  const ConfigApisProperties = {
133
- properties: {
134
- root: { type: 'string' },
135
- labels: {
159
+ properties: Object.assign(Object.assign({ root: { type: 'string' }, labels: {
136
160
  type: 'array',
137
161
  items: {
138
162
  type: 'string',
139
163
  },
140
- },
141
- styleguide: 'ConfigStyleguide',
142
- 'features.openapi': 'ConfigReferenceDocs',
143
- 'features.mockServer': 'ConfigMockServer',
144
- },
164
+ }, lint: 'ConfigStyleguide', styleguide: 'ConfigStyleguide' }, ConfigStyleguide.properties), { 'features.openapi': 'ConfigReferenceDocs', 'features.mockServer': 'ConfigMockServer' }),
145
165
  required: ['root'],
146
166
  };
147
167
  const ConfigHTTP = {
@@ -154,35 +174,6 @@ const ConfigHTTP = {
154
174
  },
155
175
  },
156
176
  };
157
- const ConfigStyleguide = {
158
- properties: {
159
- extends: {
160
- type: 'array',
161
- items: {
162
- type: 'string',
163
- },
164
- },
165
- doNotResolveExamples: { type: 'boolean' },
166
- rules: 'Rules',
167
- oas2Rules: 'Rules',
168
- oas3_0Rules: 'Rules',
169
- oas3_1Rules: 'Rules',
170
- preprocessors: { type: 'object' },
171
- oas2Preprocessors: { type: 'object' },
172
- oas3_0Preprocessors: { type: 'object' },
173
- oas3_1Preprocessors: { type: 'object' },
174
- decorators: { type: 'object' },
175
- oas2Decorators: { type: 'object' },
176
- oas3_0Decorators: { type: 'object' },
177
- oas3_1Decorators: { type: 'object' },
178
- },
179
- };
180
- const RootConfigStyleguide = {
181
- properties: Object.assign({ plugins: {
182
- type: 'array',
183
- items: { type: 'string' },
184
- } }, ConfigStyleguide.properties),
185
- };
186
177
  const Rules = {
187
178
  properties: {},
188
179
  additionalProperties: (value, key) => {