wso2 / wso2/api-platform

Improve path parameter validation in `api_validator`

Open
#179 0 comments 0 reactions 1 assignee View on GitHub

@RakhithaRR is already working on this.

Since Nov 25, 2025.

Area/AIGateway Type/Improvement
Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Current Limitation

Refer https://github.com/wso2/api-platform/pull/177#discussion_r2558409738

Suggested Improvement
 // validatePathParameters checks if path parameters have balanced braces
 func (v *APIValidator) validatePathParameters(path string) bool {
-	openCount := strings.Count(path, "{")
-	closeCount := strings.Count(path, "}")
-	return openCount == closeCount
+	depth := 0
+	for _, ch := range path {
+		if ch == '{' {
+			depth++
+			if depth > 1 {
+				return false // nested braces not allowed
+			}
+		} else if ch == '}' {
+			depth--
+			if depth < 0 {
+				return false // closing before opening
+			}
+		}
+	}
+	return depth == 0 // all braces must be closed
 }
Version

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.