Skip to content

Commit 303d41b

Browse files
committed
feat: add support for Overlay v1 documents
* linting * preprocessors * decorators * type extensions
1 parent f4cdd75 commit 303d41b

File tree

24 files changed

+200
-25
lines changed

24 files changed

+200
-25
lines changed

.changeset/funny-lobsters-thank.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@redocly/openapi-core": minor
3+
"@redocly/cli": minor
4+
---
5+
6+
Added support for linting, preprocessors, decorators, and type extensions for Overlay v1 documents.

.changeset/stale-starfishes-rule.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

__tests__/check-config/wrong-config-type-extensions-in-assertions/snapshot.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

__tests__/lint-config/invalid-config-assertation-config-type/snapshot.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/src/__tests__/utils.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ describe('checkIfRulesetExist', () => {
502502
async2: {},
503503
async3: {},
504504
arazzo1: {},
505+
overlay1: {},
505506
};
506507
expect(() => checkIfRulesetExist(rules)).toThrowError(
507508
'⚠️ No rules were configured. Learn how to configure rules: https://redocly.com/docs/cli/rules/'

packages/cli/src/wrapper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export function commandWrapper<T extends CommandOptions>(
3838
? 'asyncapi'
3939
: document?.arazzo
4040
? 'arazzo'
41+
: document?.overlay
42+
? 'overlay'
4143
: undefined;
4244
if (specKeyword) {
4345
specFullVersion = document[specKeyword] as string;

packages/core/src/bundle.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ export function mapTypeToComponent(typeName: string, version: SpecMajorVersion)
311311
default:
312312
return null;
313313
}
314+
case SpecMajorVersion.Overlay1:
315+
switch (typeName) {
316+
default:
317+
return null;
318+
}
314319
}
315320
}
316321

packages/core/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
211211
"tag-description": "warn",
212212
"tags-alphabetical": "off",
213213
},
214+
"overlay1Decorators": {},
215+
"overlay1Preprocessors": {},
216+
"overlay1Rules": {},
214217
"preprocessors": {},
215218
"recommendedFallback": false,
216219
"rules": {
@@ -437,6 +440,9 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
437440
"tag-description": "warn",
438441
"tags-alphabetical": "off",
439442
},
443+
"overlay1Decorators": {},
444+
"overlay1Preprocessors": {},
445+
"overlay1Rules": {},
440446
"preprocessors": {},
441447
"recommendedFallback": undefined,
442448
"rules": {

packages/core/src/config/__tests__/__snapshots__/config.test.ts.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ StyleguideConfig {
3232
"oas3_0": {},
3333
"oas3_1": {},
3434
},
35+
"overlay1": {
36+
"oas2": {},
37+
"oas3_0": {},
38+
"oas3_1": {},
39+
},
3540
},
3641
"doNotResolveExamples": false,
3742
"extendPaths": [],
@@ -76,6 +81,11 @@ StyleguideConfig {
7681
"oas3_0": {},
7782
"oas3_1": {},
7883
},
84+
"overlay1": {
85+
"oas2": {},
86+
"oas3_0": {},
87+
"oas3_1": {},
88+
},
7989
},
8090
"rawConfig": {
8191
"_usedRules": Set {},
@@ -203,6 +213,20 @@ StyleguideConfig {
203213
"operation-summary": "error",
204214
},
205215
},
216+
"overlay1": {
217+
"oas2": {
218+
"no-empty-servers": "error",
219+
"operation-summary": "error",
220+
},
221+
"oas3_0": {
222+
"no-empty-servers": "error",
223+
"operation-summary": "error",
224+
},
225+
"oas3_1": {
226+
"no-empty-servers": "error",
227+
"operation-summary": "error",
228+
},
229+
},
206230
},
207231
}
208232
`;

packages/core/src/config/__tests__/config.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ describe('getMergedConfig', () => {
123123
"oas2": {},
124124
"oas3_0": {},
125125
"oas3_1": {},
126+
"overlay1": {},
126127
},
127128
"doNotResolveExamples": false,
128129
"extendPaths": [],
@@ -136,6 +137,7 @@ describe('getMergedConfig', () => {
136137
"oas2": {},
137138
"oas3_0": {},
138139
"oas3_1": {},
140+
"overlay1": {},
139141
},
140142
"rawConfig": {
141143
"extendPaths": [],
@@ -164,6 +166,9 @@ describe('getMergedConfig', () => {
164166
"oas3_1": {
165167
"operation-summary": "warn",
166168
},
169+
"overlay1": {
170+
"operation-summary": "warn",
171+
},
167172
},
168173
},
169174
"telemetry": "on",
@@ -238,6 +243,7 @@ describe('getMergedConfig', () => {
238243
"oas2": {},
239244
"oas3_0": {},
240245
"oas3_1": {},
246+
"overlay1": {},
241247
},
242248
"doNotResolveExamples": false,
243249
"extendPaths": [],
@@ -251,6 +257,7 @@ describe('getMergedConfig', () => {
251257
"oas2": {},
252258
"oas3_0": {},
253259
"oas3_1": {},
260+
"overlay1": {},
254261
},
255262
"rawConfig": {
256263
"extendPaths": [],
@@ -287,6 +294,10 @@ describe('getMergedConfig', () => {
287294
"no-empty-servers": "error",
288295
"operation-summary": "error",
289296
},
297+
"overlay1": {
298+
"no-empty-servers": "error",
299+
"operation-summary": "error",
300+
},
290301
},
291302
},
292303
"telemetry": "on",

0 commit comments

Comments
 (0)