@redocly/openapi-core 1.0.0-beta.93 → 1.0.0-beta.96

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 (127) hide show
  1. package/README.md +1 -1
  2. package/__tests__/bundle.test.ts +6 -6
  3. package/__tests__/fixtures/extension.js +1 -1
  4. package/__tests__/login.test.ts +2 -2
  5. package/__tests__/normalizeVisitors.test.ts +1 -1
  6. package/__tests__/ref-utils.test.ts +1 -1
  7. package/__tests__/utils.ts +30 -18
  8. package/__tests__/walk.test.ts +6 -6
  9. package/lib/benchmark/benches/recommended-oas3.bench.js +2 -3
  10. package/lib/benchmark/utils.d.ts +2 -1
  11. package/lib/benchmark/utils.js +10 -7
  12. package/lib/bundle.d.ts +2 -2
  13. package/lib/config/all.d.ts +2 -2
  14. package/lib/config/builtIn.d.ts +1 -1
  15. package/lib/config/config-resolvers.d.ts +16 -0
  16. package/lib/config/config-resolvers.js +213 -0
  17. package/lib/config/config.d.ts +14 -129
  18. package/lib/config/config.js +17 -234
  19. package/lib/config/index.d.ts +7 -0
  20. package/lib/config/index.js +19 -0
  21. package/lib/config/load.d.ts +2 -1
  22. package/lib/config/load.js +20 -13
  23. package/lib/config/minimal.d.ts +2 -2
  24. package/lib/config/recommended.d.ts +2 -2
  25. package/lib/config/types.d.ts +113 -0
  26. package/lib/config/types.js +2 -0
  27. package/lib/config/utils.d.ts +13 -0
  28. package/lib/config/utils.js +160 -0
  29. package/lib/format/format.d.ts +1 -1
  30. package/lib/format/format.js +28 -0
  31. package/lib/index.d.ts +1 -2
  32. package/lib/index.js +5 -6
  33. package/lib/lint.d.ts +1 -1
  34. package/lib/lint.js +5 -7
  35. package/lib/redocly/index.d.ts +1 -1
  36. package/lib/redocly/index.js +1 -1
  37. package/lib/redocly/redocly-client-types.d.ts +1 -1
  38. package/lib/redocly/registry-api.d.ts +1 -1
  39. package/lib/resolve.d.ts +1 -1
  40. package/lib/resolve.js +1 -2
  41. package/lib/rules/common/assertions/index.js +1 -1
  42. package/lib/rules/common/assertions/utils.d.ts +1 -1
  43. package/lib/rules/common/assertions/utils.js +6 -2
  44. package/lib/types/index.js +2 -2
  45. package/lib/types/oas3_1.js +31 -5
  46. package/lib/utils.d.ts +4 -1
  47. package/lib/utils.js +18 -1
  48. package/package.json +7 -4
  49. package/src/__tests__/lint.test.ts +1 -1
  50. package/src/benchmark/benches/recommended-oas3.bench.ts +2 -3
  51. package/src/benchmark/benchmark.js +1 -1
  52. package/src/benchmark/utils.ts +13 -8
  53. package/src/bundle.ts +2 -1
  54. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +140 -0
  55. package/src/config/__tests__/config-resolvers.test.ts +398 -0
  56. package/src/config/__tests__/config.test.ts +244 -0
  57. package/src/config/__tests__/fixtures/plugin.js +1 -1
  58. package/src/config/__tests__/fixtures/resolve-config/api/nested-config.yaml +7 -0
  59. package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +67 -0
  60. package/src/config/__tests__/fixtures/resolve-config/local-config-with-circular.yaml +8 -0
  61. package/src/config/__tests__/fixtures/resolve-config/local-config-with-file.yaml +12 -0
  62. package/src/config/__tests__/fixtures/resolve-config/local-config.yaml +10 -0
  63. package/src/config/__tests__/fixtures/resolve-config/plugin.js +66 -0
  64. package/src/config/__tests__/fixtures/resolve-remote-configs/nested-remote-config.yaml +4 -0
  65. package/src/config/__tests__/fixtures/resolve-remote-configs/remote-config.yaml +5 -0
  66. package/src/config/__tests__/load.test.ts +8 -1
  67. package/src/config/all.ts +3 -2
  68. package/src/config/builtIn.ts +2 -1
  69. package/src/config/config-resolvers.ts +304 -0
  70. package/src/config/config.ts +40 -457
  71. package/src/config/index.ts +7 -0
  72. package/src/config/load.ts +37 -31
  73. package/src/config/minimal.ts +2 -2
  74. package/src/config/recommended.ts +2 -2
  75. package/src/config/types.ts +168 -0
  76. package/src/config/utils.ts +208 -0
  77. package/src/decorators/__tests__/remove-x-internal.test.ts +5 -5
  78. package/src/format/format.ts +36 -6
  79. package/src/index.ts +6 -2
  80. package/src/lint.ts +4 -5
  81. package/src/redocly/__tests__/redocly-client.test.ts +7 -0
  82. package/src/redocly/index.ts +4 -2
  83. package/src/redocly/redocly-client-types.ts +1 -1
  84. package/src/redocly/registry-api.ts +3 -1
  85. package/src/resolve.ts +2 -4
  86. package/src/rules/__tests__/no-unresolved-refs.test.ts +4 -4
  87. package/src/rules/common/__tests__/info-description.test.ts +3 -3
  88. package/src/rules/common/__tests__/info-license.test.ts +2 -2
  89. package/src/rules/common/__tests__/license-url.test.ts +2 -2
  90. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -1
  91. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +5 -5
  92. package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -1
  93. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +3 -3
  94. package/src/rules/common/__tests__/operation-2xx-response.test.ts +3 -3
  95. package/src/rules/common/__tests__/operation-4xx-response.test.ts +3 -3
  96. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +2 -2
  97. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -1
  98. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +4 -4
  99. package/src/rules/common/__tests__/operation-security-defined.test.ts +2 -2
  100. package/src/rules/common/__tests__/operation-singular-tag.test.ts +2 -2
  101. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +2 -2
  102. package/src/rules/common/__tests__/path-not-include-query.test.ts +2 -2
  103. package/src/rules/common/__tests__/path-params-defined.test.ts +3 -3
  104. package/src/rules/common/__tests__/paths-kebab-case.test.ts +3 -3
  105. package/src/rules/common/__tests__/spec.test.ts +1 -1
  106. package/src/rules/common/__tests__/tag-description.test.ts +2 -2
  107. package/src/rules/common/__tests__/tags-alphabetical.test.ts +2 -2
  108. package/src/rules/common/assertions/index.ts +1 -1
  109. package/src/rules/common/assertions/utils.ts +5 -2
  110. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +3 -3
  111. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
  112. package/src/rules/oas2/__tests__/spec/utils.ts +10 -7
  113. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +3 -3
  114. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +6 -6
  115. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +2 -2
  116. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +8 -8
  117. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +2 -2
  118. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +3 -3
  119. package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -1
  120. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +23 -14
  121. package/src/rules/oas3/__tests__/spec/servers.test.ts +1 -1
  122. package/src/rules/oas3/__tests__/spec/spec.test.ts +4 -4
  123. package/src/rules/oas3/__tests__/spec/utils.ts +10 -7
  124. package/src/types/index.ts +2 -2
  125. package/src/types/oas3_1.ts +32 -7
  126. package/src/utils.ts +18 -2
  127. package/tsconfig.tsbuildinfo +1 -1
@@ -17,7 +17,7 @@ describe('Oas3 info-description', () => {
17
17
  const results = await lintDocument({
18
18
  externalRefResolver: new BaseResolver(),
19
19
  document,
20
- config: makeConfig({
20
+ config: await makeConfig({
21
21
  'info-description': 'error',
22
22
  }),
23
23
  });
@@ -55,7 +55,7 @@ describe('Oas3 info-description', () => {
55
55
  const results = await lintDocument({
56
56
  externalRefResolver: new BaseResolver(),
57
57
  document,
58
- config: makeConfig({
58
+ config: await makeConfig({
59
59
  'info-description': 'error',
60
60
  }),
61
61
  });
@@ -92,7 +92,7 @@ describe('Oas3 info-description', () => {
92
92
  const results = await lintDocument({
93
93
  externalRefResolver: new BaseResolver(),
94
94
  document,
95
- config: makeConfig({
95
+ config: await makeConfig({
96
96
  'info-description': 'error',
97
97
  }),
98
98
  });
@@ -17,7 +17,7 @@ describe('Oas3 info-license', () => {
17
17
  const results = await lintDocument({
18
18
  externalRefResolver: new BaseResolver(),
19
19
  document,
20
- config: makeConfig({ 'info-license': 'error' }),
20
+ config: await makeConfig({ 'info-license': 'error' }),
21
21
  });
22
22
 
23
23
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -54,7 +54,7 @@ describe('Oas3 info-license', () => {
54
54
  const results = await lintDocument({
55
55
  externalRefResolver: new BaseResolver(),
56
56
  document,
57
- config: makeConfig({ 'info-license': 'error' }),
57
+ config: await makeConfig({ 'info-license': 'error' }),
58
58
  });
59
59
 
60
60
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -18,7 +18,7 @@ describe('Oas3 license-url', () => {
18
18
  const results = await lintDocument({
19
19
  externalRefResolver: new BaseResolver(),
20
20
  document,
21
- config: makeConfig({ 'info-license-url': 'error' }),
21
+ config: await makeConfig({ 'info-license-url': 'error' }),
22
22
  });
23
23
 
24
24
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -55,7 +55,7 @@ describe('Oas3 license-url', () => {
55
55
  const results = await lintDocument({
56
56
  externalRefResolver: new BaseResolver(),
57
57
  document,
58
- config: makeConfig({ 'info-license-url': 'error' }),
58
+ config: await makeConfig({ 'info-license-url': 'error' }),
59
59
  });
60
60
 
61
61
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -46,7 +46,7 @@ describe('no-ambiguous-paths', () => {
46
46
  const results = await lintDocument({
47
47
  externalRefResolver: new BaseResolver(),
48
48
  document,
49
- config: makeConfig({ 'no-ambiguous-paths': 'error' }),
49
+ config: await makeConfig({ 'no-ambiguous-paths': 'error' }),
50
50
  });
51
51
 
52
52
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -29,7 +29,7 @@ describe('Oas3 typed enum', () => {
29
29
  const results = await lintDocument({
30
30
  externalRefResolver: new BaseResolver(),
31
31
  document,
32
- config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
32
+ config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
33
33
  });
34
34
 
35
35
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -62,7 +62,7 @@ describe('Oas3 typed enum', () => {
62
62
  const results = await lintDocument({
63
63
  externalRefResolver: new BaseResolver(),
64
64
  document,
65
- config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
65
+ config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
66
66
  });
67
67
 
68
68
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -92,7 +92,7 @@ describe('Oas3 typed enum', () => {
92
92
  const results = await lintDocument({
93
93
  externalRefResolver: new BaseResolver(),
94
94
  document,
95
- config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
95
+ config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
96
96
  });
97
97
 
98
98
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -140,7 +140,7 @@ describe('Oas3 typed enum', () => {
140
140
  const results = await lintDocument({
141
141
  externalRefResolver: new BaseResolver(),
142
142
  document,
143
- config: makeConfig({ 'no-enum-type-mismatch': 'error' }),
143
+ config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
144
144
  });
145
145
 
146
146
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -185,7 +185,7 @@ describe('Oas3 typed enum', () => {
185
185
  const results = await lintDocument({
186
186
  externalRefResolver: new BaseResolver(),
187
187
  document,
188
- config: makeConfig({ 'spec': 'error', 'no-enum-type-mismatch': 'error' }),
188
+ config: await makeConfig({ 'spec': 'error', 'no-enum-type-mismatch': 'error' }),
189
189
  });
190
190
 
191
191
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -34,7 +34,7 @@ describe('no-identical-paths', () => {
34
34
  const results = await lintDocument({
35
35
  externalRefResolver: new BaseResolver(),
36
36
  document,
37
- config: makeConfig({ 'no-identical-paths': 'error' }),
37
+ config: await makeConfig({ 'no-identical-paths': 'error' }),
38
38
  });
39
39
 
40
40
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -19,7 +19,7 @@ describe('no-path-trailing-slash', () => {
19
19
  const results = await lintDocument({
20
20
  externalRefResolver: new BaseResolver(),
21
21
  document,
22
- config: makeConfig({ 'no-path-trailing-slash': 'error' }),
22
+ config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
23
23
  });
24
24
 
25
25
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -56,7 +56,7 @@ describe('no-path-trailing-slash', () => {
56
56
  const results = await lintDocument({
57
57
  externalRefResolver: new BaseResolver(),
58
58
  document,
59
- config: makeConfig({ 'no-path-trailing-slash': 'error' }),
59
+ config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
60
60
  });
61
61
 
62
62
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -77,7 +77,7 @@ describe('no-path-trailing-slash', () => {
77
77
  const results = await lintDocument({
78
78
  externalRefResolver: new BaseResolver(),
79
79
  document,
80
- config: makeConfig({ 'no-path-trailing-slash': 'error' }),
80
+ config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
81
81
  });
82
82
 
83
83
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -21,7 +21,7 @@ describe('Oas3 operation-2xx-response', () => {
21
21
  const results = await lintDocument({
22
22
  externalRefResolver: new BaseResolver(),
23
23
  document,
24
- config: makeConfig({ 'operation-2xx-response': 'error' }),
24
+ config: await makeConfig({ 'operation-2xx-response': 'error' }),
25
25
  });
26
26
 
27
27
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -60,7 +60,7 @@ describe('Oas3 operation-2xx-response', () => {
60
60
  const results = await lintDocument({
61
61
  externalRefResolver: new BaseResolver(),
62
62
  document,
63
- config: makeConfig({ 'operation-2xx-response': 'error' }),
63
+ config: await makeConfig({ 'operation-2xx-response': 'error' }),
64
64
  });
65
65
 
66
66
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -83,7 +83,7 @@ describe('Oas3 operation-2xx-response', () => {
83
83
  const results = await lintDocument({
84
84
  externalRefResolver: new BaseResolver(),
85
85
  document,
86
- config: makeConfig({ 'operation-2xx-response': 'error' }),
86
+ config: await makeConfig({ 'operation-2xx-response': 'error' }),
87
87
  });
88
88
 
89
89
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -21,7 +21,7 @@ describe('Oas3 operation-4xx-response', () => {
21
21
  const results = await lintDocument({
22
22
  externalRefResolver: new BaseResolver(),
23
23
  document,
24
- config: makeConfig({ 'operation-4xx-response': 'error' }),
24
+ config: await makeConfig({ 'operation-4xx-response': 'error' }),
25
25
  });
26
26
 
27
27
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -60,7 +60,7 @@ describe('Oas3 operation-4xx-response', () => {
60
60
  const results = await lintDocument({
61
61
  externalRefResolver: new BaseResolver(),
62
62
  document,
63
- config: makeConfig({ 'operation-4xx-response': 'error' }),
63
+ config: await makeConfig({ 'operation-4xx-response': 'error' }),
64
64
  });
65
65
 
66
66
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -83,7 +83,7 @@ describe('Oas3 operation-4xx-response', () => {
83
83
  const results = await lintDocument({
84
84
  externalRefResolver: new BaseResolver(),
85
85
  document,
86
- config: makeConfig({ 'operation-4xx-response': 'error' }),
86
+ config: await makeConfig({ 'operation-4xx-response': 'error' }),
87
87
  });
88
88
 
89
89
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -26,7 +26,7 @@ describe('Oas3 operation-operationId-unique', () => {
26
26
  const results = await lintDocument({
27
27
  externalRefResolver: new BaseResolver(),
28
28
  document,
29
- config: makeConfig({ 'operation-operationId-unique': 'error' }),
29
+ config: await makeConfig({ 'operation-operationId-unique': 'error' }),
30
30
  });
31
31
 
32
32
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -68,7 +68,7 @@ describe('Oas3 operation-operationId-unique', () => {
68
68
  const results = await lintDocument({
69
69
  externalRefResolver: new BaseResolver(),
70
70
  document,
71
- config: makeConfig({ 'peration-operationId-unique': 'error' }),
71
+ config: await makeConfig({ 'peration-operationId-unique': 'error' }),
72
72
  });
73
73
 
74
74
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -21,7 +21,7 @@ describe('Oas3 operation-operationId-url-safe', () => {
21
21
  const results = await lintDocument({
22
22
  externalRefResolver: new BaseResolver(),
23
23
  document,
24
- config: makeConfig({ 'operation-operationId-url-safe': 'error' }),
24
+ config: await makeConfig({ 'operation-operationId-url-safe': 'error' }),
25
25
  });
26
26
 
27
27
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -22,7 +22,7 @@ describe('Oas3 operation-parameters-unique', () => {
22
22
  const results = await lintDocument({
23
23
  externalRefResolver: new BaseResolver(),
24
24
  document,
25
- config: makeConfig({ 'operation-parameters-unique': 'error' }),
25
+ config: await makeConfig({ 'operation-parameters-unique': 'error' }),
26
26
  });
27
27
 
28
28
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -65,7 +65,7 @@ describe('Oas3 operation-parameters-unique', () => {
65
65
  const results = await lintDocument({
66
66
  externalRefResolver: new BaseResolver(),
67
67
  document,
68
- config: makeConfig({ 'operation-parameters-unique': 'error' }),
68
+ config: await makeConfig({ 'operation-parameters-unique': 'error' }),
69
69
  });
70
70
 
71
71
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -95,7 +95,7 @@ describe('Oas3 operation-parameters-unique', () => {
95
95
  const results = await lintDocument({
96
96
  externalRefResolver: new BaseResolver(),
97
97
  document,
98
- config: makeConfig({ 'operation-parameters-unique': 'error' }),
98
+ config: await makeConfig({ 'operation-parameters-unique': 'error' }),
99
99
  });
100
100
 
101
101
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -143,7 +143,7 @@ describe('Oas3 operation-parameters-unique', () => {
143
143
  const results = await lintDocument({
144
144
  externalRefResolver: new BaseResolver(),
145
145
  document,
146
- config: makeConfig({ 'operation-parameters-unique': 'error' }),
146
+ config: await makeConfig({ 'operation-parameters-unique': 'error' }),
147
147
  });
148
148
 
149
149
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -19,7 +19,7 @@ describe('Oas3 operation-security-defined', () => {
19
19
  const results = await lintDocument({
20
20
  externalRefResolver: new BaseResolver(),
21
21
  document,
22
- config: makeConfig({ 'operation-security-defined': 'error' }),
22
+ config: await makeConfig({ 'operation-security-defined': 'error' }),
23
23
  });
24
24
 
25
25
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -61,7 +61,7 @@ describe('Oas3 operation-security-defined', () => {
61
61
  const results = await lintDocument({
62
62
  externalRefResolver: new BaseResolver(),
63
63
  document,
64
- config: makeConfig({ 'operation-security-defined': 'error' }),
64
+ config: await makeConfig({ 'operation-security-defined': 'error' }),
65
65
  });
66
66
 
67
67
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -24,7 +24,7 @@ describe('Oas3 operation-singular-tag', () => {
24
24
  const results = await lintDocument({
25
25
  externalRefResolver: new BaseResolver(),
26
26
  document,
27
- config: makeConfig({ 'operation-singular-tag': 'error' }),
27
+ config: await makeConfig({ 'operation-singular-tag': 'error' }),
28
28
  });
29
29
 
30
30
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -64,7 +64,7 @@ describe('Oas3 operation-singular-tag', () => {
64
64
  const results = await lintDocument({
65
65
  externalRefResolver: new BaseResolver(),
66
66
  document,
67
- config: makeConfig({ 'operation-singular-tag': 'error' }),
67
+ config: await makeConfig({ 'operation-singular-tag': 'error' }),
68
68
  });
69
69
 
70
70
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -23,7 +23,7 @@ describe('Common path-http-verbs-order', () => {
23
23
  const results = await lintDocument({
24
24
  externalRefResolver: new BaseResolver(),
25
25
  document,
26
- config: makeConfig({ 'path-http-verbs-order': 'error' }),
26
+ config: await makeConfig({ 'path-http-verbs-order': 'error' }),
27
27
  });
28
28
 
29
29
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -87,7 +87,7 @@ describe('Common path-http-verbs-order', () => {
87
87
  const results = await lintDocument({
88
88
  externalRefResolver: new BaseResolver(),
89
89
  document,
90
- config: makeConfig({ 'path-http-verbs-order': 'error' }),
90
+ config: await makeConfig({ 'path-http-verbs-order': 'error' }),
91
91
  });
92
92
 
93
93
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -19,7 +19,7 @@ describe('Oas3 path-not-include-query', () => {
19
19
  const results = await lintDocument({
20
20
  externalRefResolver: new BaseResolver(),
21
21
  document,
22
- config: makeConfig({ 'path-not-include-query': 'error' }),
22
+ config: await makeConfig({ 'path-not-include-query': 'error' }),
23
23
  });
24
24
 
25
25
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -56,7 +56,7 @@ describe('Oas3 path-not-include-query', () => {
56
56
  const results = await lintDocument({
57
57
  externalRefResolver: new BaseResolver(),
58
58
  document,
59
- config: makeConfig({ 'path-not-include-query': 'error' }),
59
+ config: await makeConfig({ 'path-not-include-query': 'error' }),
60
60
  });
61
61
 
62
62
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -24,7 +24,7 @@ describe('Oas3 path-params-defined', () => {
24
24
  const results = await lintDocument({
25
25
  externalRefResolver: new BaseResolver(),
26
26
  document,
27
- config: makeConfig({ 'path-params-defined': 'error' }),
27
+ config: await makeConfig({ 'path-params-defined': 'error' }),
28
28
  });
29
29
 
30
30
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -52,7 +52,7 @@ describe('Oas3 path-params-defined', () => {
52
52
  const results = await lintDocument({
53
53
  externalRefResolver: new BaseResolver(),
54
54
  document,
55
- config: makeConfig({ 'path-params-defined': 'error' }),
55
+ config: await makeConfig({ 'path-params-defined': 'error' }),
56
56
  });
57
57
 
58
58
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -96,7 +96,7 @@ describe('Oas3 path-params-defined', () => {
96
96
  const results = await lintDocument({
97
97
  externalRefResolver: new BaseResolver(),
98
98
  document,
99
- config: makeConfig({ 'path-params-defined': 'error' }),
99
+ config: await makeConfig({ 'path-params-defined': 'error' }),
100
100
  });
101
101
 
102
102
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -22,7 +22,7 @@ describe('Oas3 paths-kebab-case', () => {
22
22
  const results = await lintDocument({
23
23
  externalRefResolver: new BaseResolver(),
24
24
  document,
25
- config: makeConfig({ 'paths-kebab-case': 'error' }),
25
+ config: await makeConfig({ 'paths-kebab-case': 'error' }),
26
26
  });
27
27
 
28
28
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -61,7 +61,7 @@ describe('Oas3 paths-kebab-case', () => {
61
61
  const results = await lintDocument({
62
62
  externalRefResolver: new BaseResolver(),
63
63
  document,
64
- config: makeConfig({ 'paths-kebab-case': 'error' }),
64
+ config: await makeConfig({ 'paths-kebab-case': 'error' }),
65
65
  });
66
66
 
67
67
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -98,7 +98,7 @@ describe('Oas3 paths-kebab-case', () => {
98
98
  const results = await lintDocument({
99
99
  externalRefResolver: new BaseResolver(),
100
100
  document,
101
- config: makeConfig({
101
+ config: await makeConfig({
102
102
  'paths-kebab-case': 'error',
103
103
  'no-path-trailing-slash': 'off',
104
104
  }),
@@ -25,7 +25,7 @@ describe('Oas3 spec', () => {
25
25
  const results = await lintDocument({
26
26
  externalRefResolver: new BaseResolver(),
27
27
  document,
28
- config: makeConfig({ 'spec': 'error' }),
28
+ config: await makeConfig({ 'spec': 'error' }),
29
29
  });
30
30
 
31
31
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -19,7 +19,7 @@ describe('Oas3 tag-description', () => {
19
19
  const results = await lintDocument({
20
20
  externalRefResolver: new BaseResolver(),
21
21
  document,
22
- config: makeConfig({ 'tag-description': 'error' }),
22
+ config: await makeConfig({ 'tag-description': 'error' }),
23
23
  });
24
24
 
25
25
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -57,7 +57,7 @@ describe('Oas3 tag-description', () => {
57
57
  const results = await lintDocument({
58
58
  externalRefResolver: new BaseResolver(),
59
59
  document,
60
- config: makeConfig({ 'tag-description': 'error' }),
60
+ config: await makeConfig({ 'tag-description': 'error' }),
61
61
  });
62
62
 
63
63
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -19,7 +19,7 @@ describe('Oas3 tags-alphabetical', () => {
19
19
  const results = await lintDocument({
20
20
  externalRefResolver: new BaseResolver(),
21
21
  document,
22
- config: makeConfig({ 'tags-alphabetical': 'error' }),
22
+ config: await makeConfig({ 'tags-alphabetical': 'error' }),
23
23
  });
24
24
 
25
25
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -56,7 +56,7 @@ describe('Oas3 tags-alphabetical', () => {
56
56
  const results = await lintDocument({
57
57
  externalRefResolver: new BaseResolver(),
58
58
  document,
59
- config: makeConfig({ 'tags-alphabetical': 'error' }),
59
+ config: await makeConfig({ 'tags-alphabetical': 'error' }),
60
60
  });
61
61
 
62
62
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -7,7 +7,7 @@ export const Assertions: Oas3Rule | Oas2Rule = (opts: object) => {
7
7
 
8
8
  // As 'Assertions' has an array of asserts,
9
9
  // that array spreads into an 'opts' object on init rules phase here
10
- // https://github.com/Redocly/openapi-cli/blob/master/packages/core/src/config/config.ts#L311
10
+ // https://github.com/Redocly/redocly-cli/blob/master/packages/core/src/config/config.ts#L311
11
11
  // that is why we need to iterate through 'opts' values;
12
12
  // before - filter only object 'opts' values
13
13
  const assertions: any[] = Object.values(opts).filter(
@@ -1,3 +1,4 @@
1
+ import { isRef } from '../../../ref-utils';
1
2
  import { Problem, ProblemSeverity, UserContext } from '../../../walk';
2
3
  import { asserts } from './asserts';
3
4
 
@@ -76,7 +77,7 @@ export function buildSubjectVisitor(
76
77
  asserts: AssertToApply[],
77
78
  context?: Record<string, any>[],
78
79
  ) {
79
- return function (node: any, { report, location, key, type }: UserContext) {
80
+ return function (node: any, { report, location, key, type, resolve }: UserContext) {
80
81
  // We need to check context's last node if it has the same type as subject node;
81
82
  // if yes - that means we didn't create context's last node visitor,
82
83
  // so we need to handle 'matchParentKeys' and 'excludeParentKeys' conditions here;
@@ -102,7 +103,9 @@ export function buildSubjectVisitor(
102
103
  for (const assert of asserts) {
103
104
  if (properties) {
104
105
  for (const property of properties) {
105
- runAssertion(node[property], assert, location.child(property), report);
106
+ // we can have resolvable scalar so need to resolve value here.
107
+ const value = isRef(node[property]) ? resolve(node[property])?.node : node[property];
108
+ runAssertion(value, assert, location.child(property), report);
106
109
  }
107
110
  } else {
108
111
  runAssertion(Object.keys(node), assert, location.key(), report);
@@ -21,7 +21,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
21
21
  const results = await lintDocument({
22
22
  externalRefResolver: new BaseResolver(),
23
23
  document,
24
- config: makeConfig({ 'boolean-parameter-prefixes': 'error' }),
24
+ config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }),
25
25
  });
26
26
 
27
27
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -73,7 +73,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
73
73
  const results = await lintDocument({
74
74
  externalRefResolver: new BaseResolver(),
75
75
  document,
76
- config: makeConfig({ 'boolean-parameter-prefixes': 'error' }),
76
+ config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }),
77
77
  });
78
78
 
79
79
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -97,7 +97,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
97
97
  const results = await lintDocument({
98
98
  externalRefResolver: new BaseResolver(),
99
99
  document,
100
- config: makeConfig({
100
+ config: await makeConfig({
101
101
  'boolean-parameter-prefixes': {
102
102
  severity: 'error',
103
103
  prefixes: ['should'],
@@ -21,7 +21,7 @@ describe('Referenceable scalars', () => {
21
21
  const results = await lintDocument({
22
22
  externalRefResolver: new BaseResolver(),
23
23
  document,
24
- config: makeConfig({
24
+ config: await makeConfig({
25
25
  spec: 'error',
26
26
  }),
27
27
  });
@@ -1,8 +1,7 @@
1
- import { LintConfig, RuleConfig } from '../../../../config/config';
1
+ import { LintConfig, RuleConfig, resolveLint } from '../../../../config';
2
2
  import { parseYamlToDocument } from '../../../../../__tests__/utils';
3
3
  import { lintDocument } from '../../../../lint';
4
4
  import { BaseResolver } from '../../../../resolve';
5
- import { defaultPlugin } from '../../../../config/builtIn';
6
5
 
7
6
  export async function lintDoc(
8
7
  source: string,
@@ -13,11 +12,15 @@ export async function lintDoc(
13
12
  const results = await lintDocument({
14
13
  externalRefResolver: new BaseResolver(),
15
14
  document,
16
- config: new LintConfig({
17
- plugins: [defaultPlugin],
18
- extends: [],
19
- rules,
20
- }),
15
+ config: new LintConfig(
16
+ await resolveLint({
17
+ lintConfig: {
18
+ plugins: [],
19
+ extends: [],
20
+ rules,
21
+ },
22
+ }),
23
+ ),
21
24
  });
22
25
 
23
26
  return results.map((res) => {
@@ -22,7 +22,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
22
22
  const results = await lintDocument({
23
23
  externalRefResolver: new BaseResolver(),
24
24
  document,
25
- config: makeConfig({ 'boolean-parameter-prefixes': 'error' }),
25
+ config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }),
26
26
  });
27
27
 
28
28
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -74,7 +74,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
74
74
  const results = await lintDocument({
75
75
  externalRefResolver: new BaseResolver(),
76
76
  document,
77
- config: makeConfig({ 'boolean-parameter-prefixes': 'error' }),
77
+ config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }),
78
78
  });
79
79
 
80
80
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -98,7 +98,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
98
98
  const results = await lintDocument({
99
99
  externalRefResolver: new BaseResolver(),
100
100
  document,
101
- config: makeConfig({
101
+ config: await makeConfig({
102
102
  'boolean-parameter-prefixes': {
103
103
  severity: 'error',
104
104
  prefixes: ['should'],
@@ -24,7 +24,7 @@ describe('Oas3 as3-no-servers-empty-enum', () => {
24
24
  const results = await lintDocument({
25
25
  externalRefResolver: new BaseResolver(),
26
26
  document,
27
- config: makeConfig({ 'no-servers-empty-enum': 'error' }),
27
+ config: await makeConfig({ 'no-servers-empty-enum': 'error' }),
28
28
  });
29
29
 
30
30
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -78,7 +78,7 @@ describe('Oas3 as3-no-servers-empty-enum', () => {
78
78
  const results = await lintDocument({
79
79
  externalRefResolver: new BaseResolver(),
80
80
  document,
81
- config: makeConfig({ 'no-servers-empty-enum': 'error' }),
81
+ config: await makeConfig({ 'no-servers-empty-enum': 'error' }),
82
82
  });
83
83
 
84
84
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -117,7 +117,7 @@ describe('Oas3 as3-no-servers-empty-enum', () => {
117
117
  const results = await lintDocument({
118
118
  externalRefResolver: new BaseResolver(),
119
119
  document,
120
- config: makeConfig({ 'no-servers-empty-enum': 'error' }),
120
+ config: await makeConfig({ 'no-servers-empty-enum': 'error' }),
121
121
  });
122
122
 
123
123
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -141,7 +141,7 @@ describe('Oas3 as3-no-servers-empty-enum', () => {
141
141
  const results = await lintDocument({
142
142
  externalRefResolver: new BaseResolver(),
143
143
  document,
144
- config: makeConfig({ 'no-servers-empty-enum': 'error' }),
144
+ config: await makeConfig({ 'no-servers-empty-enum': 'error' }),
145
145
  });
146
146
 
147
147
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -168,7 +168,7 @@ describe('Oas3 as3-no-servers-empty-enum', () => {
168
168
  const results = await lintDocument({
169
169
  externalRefResolver: new BaseResolver(),
170
170
  document,
171
- config: makeConfig({ 'no-servers-empty-enum': 'error' }),
171
+ config: await makeConfig({ 'no-servers-empty-enum': 'error' }),
172
172
  });
173
173
 
174
174
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -197,7 +197,7 @@ describe('Oas3 as3-no-servers-empty-enum', () => {
197
197
  const results = await lintDocument({
198
198
  externalRefResolver: new BaseResolver(),
199
199
  document,
200
- config: makeConfig({ 'no-servers-empty-enum': 'error' }),
200
+ config: await makeConfig({ 'no-servers-empty-enum': 'error' }),
201
201
  });
202
202
 
203
203
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);