@redocly/openapi-core 1.1.0 → 1.2.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 (77) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +250 -7
  3. package/lib/bundle.d.ts +12 -6
  4. package/lib/bundle.js +34 -24
  5. package/lib/config/builtIn.js +4 -0
  6. package/lib/config/config-resolvers.js +19 -6
  7. package/lib/config/config.d.ts +9 -9
  8. package/lib/config/config.js +32 -17
  9. package/lib/config/load.d.ts +3 -2
  10. package/lib/config/load.js +2 -2
  11. package/lib/config/rules.d.ts +2 -2
  12. package/lib/config/types.d.ts +10 -3
  13. package/lib/index.d.ts +4 -3
  14. package/lib/index.js +10 -6
  15. package/lib/lint.js +10 -16
  16. package/lib/oas-types.d.ts +16 -10
  17. package/lib/oas-types.js +52 -26
  18. package/lib/rules/async2/channels-kebab-case.d.ts +2 -0
  19. package/lib/rules/async2/channels-kebab-case.js +19 -0
  20. package/lib/rules/async2/index.d.ts +12 -0
  21. package/lib/rules/async2/index.js +22 -0
  22. package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -0
  23. package/lib/rules/async2/no-channel-trailing-slash.js +16 -0
  24. package/lib/rules/common/assertions/asserts.js +12 -4
  25. package/lib/rules/common/scalar-property-missing-example.js +1 -1
  26. package/lib/rules/common/spec.d.ts +2 -2
  27. package/lib/rules/common/spec.js +3 -3
  28. package/lib/rules/oas2/index.js +1 -1
  29. package/lib/rules/oas3/index.js +1 -1
  30. package/lib/rules/oas3/no-server-example.com.js +3 -2
  31. package/lib/types/asyncapi.d.ts +2 -0
  32. package/lib/types/asyncapi.js +1034 -0
  33. package/lib/types/oas3_1.js +8 -1
  34. package/lib/types/redocly-yaml.js +3 -0
  35. package/lib/typings/asyncapi.d.ts +21 -0
  36. package/lib/typings/asyncapi.js +2 -0
  37. package/lib/visitors.d.ts +12 -0
  38. package/lib/walk.d.ts +3 -3
  39. package/package.json +4 -2
  40. package/src/__tests__/__snapshots__/bundle.test.ts.snap +1 -1
  41. package/src/__tests__/bundle.test.ts +65 -25
  42. package/src/__tests__/fixtures/lint/openapi.yaml +10 -0
  43. package/src/__tests__/fixtures/redocly.yaml +2 -0
  44. package/src/__tests__/lint.test.ts +67 -8
  45. package/src/bundle.ts +62 -35
  46. package/src/config/__tests__/__snapshots__/config.test.ts.snap +24 -0
  47. package/src/config/__tests__/config.test.ts +15 -4
  48. package/src/config/__tests__/load.test.ts +35 -2
  49. package/src/config/builtIn.ts +4 -0
  50. package/src/config/config-resolvers.ts +25 -6
  51. package/src/config/config.ts +51 -27
  52. package/src/config/load.ts +11 -4
  53. package/src/config/rules.ts +2 -2
  54. package/src/config/types.ts +17 -4
  55. package/src/index.ts +10 -2
  56. package/src/lint.ts +13 -22
  57. package/src/oas-types.ts +59 -21
  58. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +141 -0
  59. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +97 -0
  60. package/src/rules/async2/channels-kebab-case.ts +18 -0
  61. package/src/rules/async2/index.ts +22 -0
  62. package/src/rules/async2/no-channel-trailing-slash.ts +15 -0
  63. package/src/rules/common/assertions/asserts.ts +16 -4
  64. package/src/rules/common/scalar-property-missing-example.ts +2 -2
  65. package/src/rules/common/spec.ts +2 -2
  66. package/src/rules/oas2/index.ts +2 -2
  67. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +36 -1
  68. package/src/rules/oas3/__tests__/spec/spec.test.ts +1 -1
  69. package/src/rules/oas3/index.ts +2 -2
  70. package/src/rules/oas3/no-server-example.com.ts +3 -2
  71. package/src/types/asyncapi.ts +1142 -0
  72. package/src/types/oas3_1.ts +7 -1
  73. package/src/types/redocly-yaml.ts +3 -0
  74. package/src/typings/asyncapi.ts +26 -0
  75. package/src/visitors.ts +22 -0
  76. package/src/walk.ts +3 -3
  77. package/tsconfig.tsbuildinfo +1 -1
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OasSpec = void 0;
3
+ exports.Spec = void 0;
4
4
  const types_1 = require("../../types");
5
5
  const utils_1 = require("../utils");
6
6
  const ref_utils_1 = require("../../ref-utils");
7
7
  const utils_2 = require("../../utils");
8
- const OasSpec = () => {
8
+ 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;
@@ -156,4 +156,4 @@ const OasSpec = () => {
156
156
  },
157
157
  };
158
158
  };
159
- exports.OasSpec = OasSpec;
159
+ exports.Spec = Spec;
@@ -44,7 +44,7 @@ const scalar_property_missing_example_1 = require("../common/scalar-property-mis
44
44
  const required_string_property_missing_min_length_1 = require("../common/required-string-property-missing-min-length");
45
45
  const spec_strict_refs_1 = require("../common/spec-strict-refs");
46
46
  exports.rules = {
47
- spec: spec_1.OasSpec,
47
+ spec: spec_1.Spec,
48
48
  'no-invalid-schema-examples': no_invalid_schema_examples_1.NoInvalidSchemaExamples,
49
49
  'no-invalid-parameter-examples': no_invalid_parameter_examples_1.NoInvalidParameterExamples,
50
50
  'info-contact': info_contact_1.InfoContact,
@@ -55,7 +55,7 @@ const required_string_property_missing_min_length_1 = require("../common/require
55
55
  const spec_strict_refs_1 = require("../common/spec-strict-refs");
56
56
  const component_name_unique_1 = require("./component-name-unique");
57
57
  exports.rules = {
58
- spec: spec_1.OasSpec,
58
+ spec: spec_1.Spec,
59
59
  'info-contact': info_contact_1.InfoContact,
60
60
  'info-license': info_license_1.InfoLicense,
61
61
  'info-license-url': info_license_url_1.InfoLicenseUrl,
@@ -4,9 +4,10 @@ exports.NoServerExample = void 0;
4
4
  const NoServerExample = () => {
5
5
  return {
6
6
  Server(server, { report, location }) {
7
- if (['example.com', 'localhost'].indexOf(server.url) !== -1) {
7
+ const pattern = /^(.*[\/.])?(example\.com|localhost)([\/:?].*|$)/;
8
+ if (server.url && pattern.test(server.url)) {
8
9
  report({
9
- message: 'Server `url` should not point at example.com.',
10
+ message: 'Server `url` should not point to example.com or localhost.',
10
11
  location: location.child(['url']),
11
12
  });
12
13
  }
@@ -0,0 +1,2 @@
1
+ import { NodeType } from '.';
2
+ export declare const AsyncApi2Types: Record<string, NodeType>;