Skip to content

Commit

Permalink
fix(pkg/protoanalysis): support HTTP rule parameter arguments (#3592)
Browse files Browse the repository at this point in the history
* fix(pkg/protoanalysis): support HTTP rule parameter arguments

Proto HTTP rule parameters can have extra arguments which are defined
after a "=", for example "/foo/{bar=**}".

* chore: update changelog

---------

Co-authored-by: Danilo Pantani <[email protected]>
  • Loading branch information
jeronimoalbi and Pantani authored Jul 26, 2023
1 parent c494648 commit e0215e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
- [#3559](https://github.com/ignite/cli/pull/3559) Bump network plugin version to `v0.1.1`
- [#3522](https://github.com/ignite/cli/pull/3522) Remove indentation from `chain serve` output

### Fixes

- [#3592](https://github.com/ignite/cli/pull/3592) fix(pkg/protoanalysis): support HTTP rule parameter arguments

## [`v0.27.0`](https://github.com/ignite/cli/releases/tag/v0.27.0)

### Features
Expand Down
6 changes: 5 additions & 1 deletion ignite/pkg/protoanalysis/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ func (b builder) elementsToHTTPRules(requestMessage *proto.Message, elems []prot
return
}

var urlParamRe = regexp.MustCompile(`(?m){(.+?)}`)
// Regexp to extract HTTP rule URL parameter names.
// The expression extracts parameter names defined within "{}".
// Extra parameter arguments are ignored. These arguments are normally
// defined after an "=", for example as "{param=**}".
var urlParamRe = regexp.MustCompile(`(?m){([^=]+?)(?:=.+?)?}`)

func (b builder) constantToHTTPRules(requestMessage *proto.Message, constant proto.Literal) (httpRules []HTTPRule) {
// find out the endpoint template.
Expand Down

0 comments on commit e0215e3

Please sign in to comment.