Skip to content

Support multiple template paths and matching - #64

Merged
AButler merged 3 commits into
mainfrom
multiple-template-paths
Aug 7, 2026
Merged

Support multiple template paths and matching#64
AButler merged 3 commits into
mainfrom
multiple-template-paths

Conversation

@AButler

@AButler AButler commented Aug 7, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves OpenAPI path matching when multiple templated paths could match the same request path, aiming to choose the most specific template match and making the result independent of path-definition order. It also expands the test OpenAPI documents and adds regression tests around literal-vs-templated ambiguity.

Changes:

  • Add a scoring mechanism to select the “best” matching templated path when more than one template matches a request path.
  • Extend existing OpenAPI test data with additional overlapping templated/literal paths and add a reversed-definition-order variant.
  • Add new response validation tests to cover the new ambiguous path scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/OpenApiValidate.Tests/TestData/LiteralAndTemplatedPathReversed.yaml New test OpenAPI document with reversed path definition order to validate deterministic matching.
test/OpenApiValidate.Tests/TestData/LiteralAndTemplatedPath.yaml Extend test OpenAPI document with additional overlapping role paths to exercise template specificity.
test/OpenApiValidate.Tests/ResponseValidatorTests.cs Add regression tests validating DELETE matching for overlapping literal/templated role paths (including reversed spec order).
src/OpenApiValidate/Helpers/OpenApiExtensions.cs Implement template “best match” selection logic for TryMatchPath and refactor template-segment detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/OpenApiValidate/Helpers/OpenApiExtensions.cs Outdated
Comment thread test/OpenApiValidate.Tests/TestData/LiteralAndTemplatedPath.yaml Outdated
Comment thread src/OpenApiValidate/Helpers/OpenApiExtensions.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@AButler
AButler merged commit 9df557a into main Aug 7, 2026
2 checks passed
@AButler
AButler deleted the multiple-template-paths branch August 7, 2026 10:40
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.

2 participants