Skip to content

Conversation

lukaszzazulak
Copy link
Contributor

Migrate linting rule for disallowing equivalent paths in OAS2

@lukaszzazulak lukaszzazulak requested a review from Copilot August 8, 2025 11:35
@lukaszzazulak lukaszzazulak added the enhancement New feature or request label Aug 8, 2025
Copy link

@Copilot Copilot AI left a 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

@lukaszzazulak lukaszzazulak changed the title feat(ls): migrate linting rule for disallowing equivalent paths in Op… feat(ls): migrate disallowing equivalent paths in OAS2 Aug 8, 2025
@lukaszzazulak lukaszzazulak force-pushed the feat/SWG-15851-Port-validation-rules-for-Path-element branch from 74529ca to 66e4118 Compare August 8, 2025 11:56
@lukaszzazulak lukaszzazulak force-pushed the feat/SWG-15851-Port-validation-rules-for-Path-element branch from 81e0693 to 2d74ad3 Compare August 12, 2025 10:13
Co-authored-by: robert-hebel-sb <[email protected]>
@lukaszzazulak lukaszzazulak force-pushed the feat/SWG-15851-Port-validation-rules-for-Path-element branch from 2d74ad3 to e7b9a6d Compare August 12, 2025 10:15
…h-element

# Conflicts:
#	packages/apidom-ls/src/services/validation/linter-functions.ts
#	packages/apidom-ls/test/validate.ts
@lukaszzazulak lukaszzazulak merged commit 0066f1c into main Aug 29, 2025
8 checks passed
@lukaszzazulak lukaszzazulak deleted the feat/SWG-15851-Port-validation-rules-for-Path-element branch August 29, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants