Improve path parameter validation in `api_validator`
Open
@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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.