Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: overlay linting, decorators, preprocessors, types extension support #1898

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

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
Loading