Skip to content

Commit

Permalink
fix regex names
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Sep 29, 2023
1 parent 67c17c7 commit 92ed984
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
],
"name": "Path_parameter_test-getBatchWithParams",
"paths": [
"~/batchs\\(Material='(?\u003cMaterial\u003e[^#?/]+)',Batch='(?\u003cBatch\u003e[^#?/]+)'\\)$"
"~/batchs\\(Material='(?\u003cmaterial\u003e[^#?/]+)',Batch='(?\u003cbatch\u003e[^#?/]+)'\\)$"
],
"plugins": [],
"regex_priority": 100,
Expand All @@ -51,7 +51,7 @@
],
"name": "Path_parameter_test-postBatchWithParams",
"paths": [
"~/batchs\\(Material='(?\u003cMaterial\u003e[^#?/]+)',Batch='(?\u003cBatch\u003e[^#?/]+)'\\)$"
"~/batchs\\(Material='(?\u003cmaterial\u003e[^#?/]+)',Batch='(?\u003cbatch\u003e[^#?/]+)'\\)$"
],
"plugins": [],
"regex_priority": 100,
Expand All @@ -68,7 +68,7 @@
],
"name": "Path_parameter_test-opsid",
"paths": [
"~/demo/(?\u003csomething\u003e[^#?/]+)/else/(?\u003ca_to_do\u003e[^#?/]+)/$"
"~/demo/(?\u003csomething\u003e[^#?/]+)/else/(?\u003cto_do\u003e[^#?/]+)/$"
],
"plugins": [],
"regex_priority": 100,
Expand Down
2 changes: 2 additions & 0 deletions openapi2kong/openapi2kong.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func Slugify(name ...string) string {
// The returned name will be valid for PCRE regex captures; Alphanumeric + '_', starting
// with [a-zA-Z].
func sanitizeRegexCapture(varName string) string {
slugify.ToLower = true
slugify.Separator = "-"
varName = slugify.Slugify(varName)
varName = strings.ReplaceAll(varName, "-", "_")
if strings.HasPrefix(varName, "_") {
Expand Down

0 comments on commit 92ed984

Please sign in to comment.