-
Notifications
You must be signed in to change notification settings - Fork 20
feat(ls): migrate disallowing equivalent paths in OAS2 #4987
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
base: main
Are you sure you want to change the base?
feat(ls): migrate disallowing equivalent paths in OAS2 #4987
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates a linting rule to detect and disallow equivalent paths in OpenAPI 2.0 specifications. The rule identifies when paths with different parameter names but the same structure (e.g., /items/{id}
and /items/{itemId}
) are defined, which violates OpenAPI 2.0 specification requirements.
- Added a new linter function
apilintNoEquivalentPaths
that normalizes path templates to detect equivalency - Created a new lint rule configuration for OpenAPI 2.0 path templates
- Added comprehensive test coverage with a test fixture demonstrating the violation
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/apidom-ls/src/services/validation/linter-functions.ts |
Implements the core logic for detecting equivalent paths by normalizing path templates |
packages/apidom-ls/src/config/openapi/path-template/lint/equivalent-paths-not-allowed.ts |
Defines the lint rule configuration with error code, message, and target specifications |
packages/apidom-ls/src/config/openapi/path-template/lint/index.ts |
Registers the new lint rule in the path template linting system |
packages/apidom-ls/src/config/codes.ts |
Adds the new error code for equivalent paths validation |
packages/apidom-ls/test/validate.ts |
Adds test case verifying the linting rule works correctly |
packages/apidom-ls/test/fixtures/validation/oas/equivalent-paths-not-allowed.yaml |
Test fixture with equivalent paths to trigger the validation error |
74529ca
to
66e4118
Compare
packages/apidom-ls/src/config/openapi/path-template/lint/value--equivalent-not-allowed.ts
Outdated
Show resolved
Hide resolved
packages/apidom-ls/src/config/openapi/path-template/lint/value--equivalent-not-allowed.ts
Outdated
Show resolved
Hide resolved
81e0693
to
2d74ad3
Compare
Co-authored-by: robert-hebel-sb <[email protected]>
2d74ad3
to
e7b9a6d
Compare
Migrate linting rule for disallowing equivalent paths in OAS2