Skip to content
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

Expose numberOfParameters on PathTemplate #2509

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

Mahoney
Copy link
Collaborator

@Mahoney Mahoney commented Nov 29, 2023

Some specifications (e.g. OpenAPI v3) require choosing a path template by how specific they are.

Exposing the number of parameters allows sorting a set of templates by how specific they are.

Submitter checklist

  • Recommended: Join WireMock Slack to get any help in #help-contributing or a project-specific channel like #wiremock-java
  • Recommended: If you participate in Hacktoberfest 2023, make sure you're signed up there and in the WireMock form
  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

Some specifications (e.g. [OpenAPI v3](https://spec.openapis.org/oas/v3.0.3#path-templating-matching))
require choosing a path template by how specific they are.

Exposing the number of parameters allows sorting a set of templates by
how specific they are.
@Mahoney Mahoney requested a review from a team as a code owner November 29, 2023 11:05
@@ -28,7 +28,7 @@

public class PathTemplate {
static final Pattern SPECIAL_SYMBOL_REGEX =
Pattern.compile("(?:\\{(?<variable>[^}]+)\\})|(?<wildcard>\\*\\*)");
Pattern.compile("\\{(?<variable>[^}]+)}|(?<wildcard>\\*\\*)");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IntelliJ told me these regex syntaxes were unnecessary, and removing them left all the tests passing, so I believed it.

Copy link
Contributor

@leeturner leeturner left a comment

Choose a reason for hiding this comment

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

Nice 👍

@Mahoney Mahoney merged commit 3e9e55d into master Nov 29, 2023
7 checks passed
@Mahoney Mahoney deleted the expose-path-template-parameter-size branch November 29, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants