Skip to content

Commit

Permalink
feat: add support for Overlay v1 documents
Browse files Browse the repository at this point in the history
* linting
* preprocessors
* decorators
* type extensions
  • Loading branch information
jeremyfiel committed Feb 10, 2025
1 parent f4cdd75 commit 303d41b
Show file tree
Hide file tree
Showing 24 changed files with 200 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .changeset/funny-lobsters-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@redocly/openapi-core": minor
"@redocly/cli": minor
---

Added support for linting, preprocessors, decorators, and type extensions for Overlay v1 documents.
6 changes: 0 additions & 6 deletions .changeset/stale-starfishes-rule.md

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/cli/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ describe('checkIfRulesetExist', () => {
async2: {},
async3: {},
arazzo1: {},
overlay1: {},
};
expect(() => checkIfRulesetExist(rules)).toThrowError(
'⚠️ No rules were configured. Learn how to configure rules: https://redocly.com/docs/cli/rules/'
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export function commandWrapper<T extends CommandOptions>(
? 'asyncapi'
: document?.arazzo
? 'arazzo'
: document?.overlay
? 'overlay'
: undefined;
if (specKeyword) {
specFullVersion = document[specKeyword] as string;
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ export function mapTypeToComponent(typeName: string, version: SpecMajorVersion)
default:
return null;
}
case SpecMajorVersion.Overlay1:
switch (typeName) {
default:
return null;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
"tag-description": "warn",
"tags-alphabetical": "off",
},
"overlay1Decorators": {},
"overlay1Preprocessors": {},
"overlay1Rules": {},
"preprocessors": {},
"recommendedFallback": false,
"rules": {
Expand Down Expand Up @@ -437,6 +440,9 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
"tag-description": "warn",
"tags-alphabetical": "off",
},
"overlay1Decorators": {},
"overlay1Preprocessors": {},
"overlay1Rules": {},
"preprocessors": {},
"recommendedFallback": undefined,
"rules": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ StyleguideConfig {
"oas3_0": {},
"oas3_1": {},
},
"overlay1": {
"oas2": {},
"oas3_0": {},
"oas3_1": {},
},
},
"doNotResolveExamples": false,
"extendPaths": [],
Expand Down Expand Up @@ -76,6 +81,11 @@ StyleguideConfig {
"oas3_0": {},
"oas3_1": {},
},
"overlay1": {
"oas2": {},
"oas3_0": {},
"oas3_1": {},
},
},
"rawConfig": {
"_usedRules": Set {},
Expand Down Expand Up @@ -203,6 +213,20 @@ StyleguideConfig {
"operation-summary": "error",
},
},
"overlay1": {
"oas2": {
"no-empty-servers": "error",
"operation-summary": "error",
},
"oas3_0": {
"no-empty-servers": "error",
"operation-summary": "error",
},
"oas3_1": {
"no-empty-servers": "error",
"operation-summary": "error",
},
},
},
}
`;
11 changes: 11 additions & 0 deletions packages/core/src/config/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ describe('getMergedConfig', () => {
"oas2": {},
"oas3_0": {},
"oas3_1": {},
"overlay1": {},
},
"doNotResolveExamples": false,
"extendPaths": [],
Expand All @@ -136,6 +137,7 @@ describe('getMergedConfig', () => {
"oas2": {},
"oas3_0": {},
"oas3_1": {},
"overlay1": {},
},
"rawConfig": {
"extendPaths": [],
Expand Down Expand Up @@ -164,6 +166,9 @@ describe('getMergedConfig', () => {
"oas3_1": {
"operation-summary": "warn",
},
"overlay1": {
"operation-summary": "warn",
},
},
},
"telemetry": "on",
Expand Down Expand Up @@ -238,6 +243,7 @@ describe('getMergedConfig', () => {
"oas2": {},
"oas3_0": {},
"oas3_1": {},
"overlay1": {},
},
"doNotResolveExamples": false,
"extendPaths": [],
Expand All @@ -251,6 +257,7 @@ describe('getMergedConfig', () => {
"oas2": {},
"oas3_0": {},
"oas3_1": {},
"overlay1": {},
},
"rawConfig": {
"extendPaths": [],
Expand Down Expand Up @@ -287,6 +294,10 @@ describe('getMergedConfig', () => {
"no-empty-servers": "error",
"operation-summary": "error",
},
"overlay1": {
"no-empty-servers": "error",
"operation-summary": "error",
},
},
},
"telemetry": "on",
Expand Down
Loading

0 comments on commit 303d41b

Please sign in to comment.