Skip to content

Recognize path variables followed by :verb (AIP-136 custom methods) - #944

Open
simon446 wants to merge 1 commit into
postmanlabs:developfrom
simon446:fix/path-variable-with-colon-suffix
Open

Recognize path variables followed by :verb (AIP-136 custom methods)#944
simon446 wants to merge 1 commit into
postmanlabs:developfrom
simon446:fix/path-variable-with-colon-suffix

Conversation

@simon446

@simon446 simon446 commented May 21, 2026

Copy link
Copy Markdown

Summary

findPathVariablesFromPath requires every {{name}} placeholder to be followed by / or end-of-string. Paths shaped like /tasks/{{id}}:cancelAIP-136 custom methods — therefore fall through to findCollectionVariablesFromPath and are demoted to collection variables instead of path variables. Extend the lookahead to also accept :.

Repro

paths:
  /tasks/{id}:cancel:
    post:
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }

Expected: :id is emitted as a path variable on the resulting Postman item.
Actual: {{id}} is emitted as a collection (environment) variable; the item has no path variable for id.

Fix

One-character regex change in lib/schemaUtils.js:

- return path.match(/(\/\{\{[^\/\{\}]+\}\})(?=\/|$)/g);
+ return path.match(/(\/\{\{[^\/\{\}]+\}\})(?=\/|$|:)/g);

: is the AIP-136 boundary character. It is not expected inside a path-segment literal in an OpenAPI path template, so it's a safe lookahead. Existing behavior for /{{file}}.{{format}} and similar literal-with-templates is unchanged.

Tests

Two assertions added to test/unit/util.test.js in the findPathVariablesFromPath function block, covering a single-placeholder custom method and a placeholder + custom method + trailing placeholder.

References

`findPathVariablesFromPath` required every `{{name}}` placeholder to be
followed by `/` or end-of-string. Paths shaped like `/tasks/{{id}}:cancel`
— AIP-136 custom methods — fell through to `findCollectionVariablesFromPath`
and were demoted to collection variables. Extend the lookahead to also
accept `:`; it's the AIP-136 boundary and is not expected inside a
path-segment literal in OpenAPI path templates, so it's a safe addition.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant