Skip to content

Conversation

@DmitryAnansky
Copy link
Contributor

@DmitryAnansky DmitryAnansky commented Dec 4, 2025

What/Why/How?

NOTE: SIMILAR FIX SHOULD BE APPLIED TO OLDER REDOCLY/CLI VERSION.

Added additional path-parameters-defined rule context during validation to track parameters for Path and Path that comes from callback.

Having this part of description as an example:

paths:
  /projects/{projectId}:
    post:
      operationId: createProject
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
      callbacks:
        onEvent:
          '{$request.body#/callbackUrl}':
            post:
              responses:
                '200':
                  description: OK
                '400':
                  description: Bad Request
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                callbackUrl:
                  type: string
      responses:
        '201':
          description: Created

    patch:
      operationId: updateProject
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK

Both /projects/{projectId} and {$request.body#/callbackUrl} validated by this rule as a separate PathItem.
The issue was that without context tracking we were handling patch operation as if it a part of {$request.body#/callbackUrl} path.

This time instead of having additional context and stack we are going to narrow down visitor access, handling separately Callback inside PathItem.

Reference

Closes: #2436

Testing

Screenshots (optional)

Check yourself

  • Code changed? - Tested with Redoc/Realm/Reunite (internal)
  • All new/updated code is covered by tests
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 4a08ebc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/openapi-core Patch
@redocly/cli Patch
@redocly/respect-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@DmitryAnansky DmitryAnansky marked this pull request as ready for review December 4, 2025 18:48
@DmitryAnansky DmitryAnansky requested a review from a team as a code owner December 4, 2025 18:48
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.69% (🎯 78%) 5911 / 7511
🔵 Statements 78.14% (🎯 78%) 6107 / 7815
🔵 Functions 81.89% (🎯 81%) 1221 / 1491
🔵 Branches 70.73% (🎯 70%) 4064 / 5745
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/rules/common/path-params-defined.ts 96.49% 96% 92.59% 98.18% 103, 116
Generated in workflow #8097 for commit 4a08ebc by the Vitest Coverage Report Action

@AlbinaBlazhko17
Copy link
Contributor

Have you tested this implementation with the different scenarios? e.g. adding unused parameters in the patch and in the callback operation?

@DmitryAnansky
Copy link
Contributor Author

Have you tested this implementation with the different scenarios? e.g. adding unused parameters in the patch and in the callback operation?

Yes, its running the test from this branch #2438

@DmitryAnansky DmitryAnansky changed the base branch from fix/path-params-defined-false-positive-error-in-callback to main December 5, 2025 11:02
@DmitryAnansky DmitryAnansky requested a review from a team as a code owner December 5, 2025 11:02
@DmitryAnansky DmitryAnansky force-pushed the fix/alternative-path-params-defined-false-positive-error branch from 15b8e3e to 2af5c22 Compare December 5, 2025 11:04
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

Command Mean [s] Min [s] Max [s] Relative
redocly lint resources/rebilly.yaml 1.386 ± 0.021 1.345 1.407 1.00
redocly-next lint resources/rebilly.yaml 1.389 ± 0.019 1.358 1.415 1.00 ± 0.02

@DmitryAnansky DmitryAnansky changed the title chore: alternative approach to fix path-params-defined issue fix: path-parameters-defined rule false positive Dec 5, 2025
@DmitryAnansky DmitryAnansky force-pushed the fix/alternative-path-params-defined-false-positive-error branch from 9967992 to b7e901f Compare December 8, 2025 11:34
@DmitryAnansky DmitryAnansky requested a review from tatomyr December 8, 2025 13:27
@DmitryAnansky DmitryAnansky added the snapshot Create experimental release PR label Dec 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

📦 A new experimental 🧪 version v0.0.0-snapshot.1765200839 of Redocly CLI has been published for testing.

Install with NPM:

npm install @redocly/[email protected]
# or
npm install @redocly/[email protected]
# or
npm install @redocly/[email protected]

⚠️ Note: This is a development build and may contain unstable features.

@DmitryAnansky DmitryAnansky force-pushed the fix/alternative-path-params-defined-false-positive-error branch from e948b2f to 4a08ebc Compare December 8, 2025 13:42
@DmitryAnansky DmitryAnansky merged commit 61f09f7 into main Dec 8, 2025
62 of 64 checks passed
@DmitryAnansky DmitryAnansky deleted the fix/alternative-path-params-defined-false-positive-error branch December 8, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

snapshot Create experimental release PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

path-parameters-defined rule false positive: validates sibling operation's path parameters against callback URL runtime expressions

5 participants