diff --git a/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcher.java b/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcher.java index 1753bb92..819a85a6 100644 --- a/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcher.java +++ b/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcher.java @@ -64,7 +64,7 @@ */ public class UrlPatternMatcher { // Finds parameters in the URL pattern string. - private static final String URL_PARAM_REGEX = "\\{(\\w*?)\\}"; + private static final String URL_PARAM_REGEX = "\\{(\\S*?)\\}"; // Replaces parameter names in the URL pattern string to match parameters in URLs. private static final String URL_PARAM_MATCH_REGEX = "\\([%\\\\w-.\\\\~!\\$&'\\\\(\\\\)\\\\*\\\\+,;=:\\\\[\\\\]@]+?\\)"; diff --git a/runtime/src/test/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcherTest.java b/runtime/src/test/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcherTest.java index 352bc488..9610f7bf 100644 --- a/runtime/src/test/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcherTest.java +++ b/runtime/src/test/java/io/quarkiverse/openapi/generator/providers/UrlPatternMatcherTest.java @@ -31,7 +31,8 @@ private static Stream providePathsThatMatch() { Arguments.of("/{id}/pets/{id2}", "/1/pets/2?q=1&q2=2"), Arguments.of("/{id}/{foo}/{id2}", "/1/2/3?q=1&q2=2"), Arguments.of("/{id}/{foo}/{id2}", "/1/2/3"), - Arguments.of("/v2/pets/{id}", "/v2/pets/1")); + Arguments.of("/v2/pets/{id}", "/v2/pets/1"), + Arguments.of("/pets/{pet-id}/types/{type-id}", "/pets/1/types/2")); } } \ No newline at end of file