wso2 / wso2/api-platform

Support regular-expression paths in RestApi operations

Open
#2,067 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

The gateway-controller's RestApi Operation.Path (api.yaml) supports only three path forms — an exact path, the /* wildcard prefix, and {param} single-segment placeholders (gateway/gateway-controller/pkg/xds/translator.go).
Literal portions are regexp.QuoteMeta-escaped before being compiled to an Envoy SafeRegex, so any regex metacharacters a user puts in a path are matched literally — there is no way to define an arbitrary regular-expression path.

This also limits the Gateway API operator flow: a HTTPRoute match of type: RegularExpression has no faithful RestApi equivalent, so the operator rejects it with an Invalid config error (see #2021 and PR #2066).

Adding first-class regex path support to the RestApi YAML would let users define regex-based operation paths directly, and would unblock the operator mapping HTTPRoute RegularExpression matches instead of rejecting them.

Possible approach: introduce an explicit path-match type on the operation (e.g. pathType: exact | prefix | regex, or a dedicated pathRegex field) so the controller emits a SafeRegex route from a user-provided pattern, with validation that rejects invalid or unsafe (e.g. catastrophic-backtracking) patterns.

Version

No response

Related Issue

#2021, #2066

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.

Research direction

Start with gateway/gateway-controller/pkg/xds/translator.go and the RestApi Operation definition in api.yaml to understand the existing exact, prefix, and parameter path handling. Review #2021 and PR #2066 for the Gateway API operator requirements. Done means RestApi can represent a validated regular-expression path and the operator can map HTTPRoute RegularExpression matches without rejecting them.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.