Skip to content

Commit

Permalink
[core] approve json-like arrays as apricot query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
knopers8 authored and teo committed Mar 20, 2024
1 parent 87f6403 commit e2d7c9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configuration/componentcfg/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
inputFullRegex = regexp.MustCompile(`^([a-zA-Z0-9-_]+)(\/[A-Z0-9-_]+){1}(\/[a-z-A-Z0-9-_]+){1}(\/[a-z-A-Z0-9-_]+){1}(\@[0-9]+)?$`)
// component /RUNTYPE /rolename
inputEntriesRegex = regexp.MustCompile(`^([a-zA-Z0-9-_]+)(\/[A-Z0-9-_]+){1}(\/[a-z-A-Z0-9-_]+){1}$`)
inputParametersRegex = regexp.MustCompile(`^([a-zA-Z0-9-_]+=[a-zA-Z0-9-_,]+)(&[a-zA-Z0-9-_]+=[a-zA-Z0-9-_,]+)*$`)
inputParametersRegex = regexp.MustCompile(`^([a-zA-Z0-9-_]+=[a-zA-Z0-9-_,]+)(&[a-zA-Z0-9-_]+=[a-zA-Z0-9-_,"\[\]]+)*$`)
E_BAD_KEY = errors.New("bad component configuration key format")
)

Expand Down
3 changes: 2 additions & 1 deletion configuration/componentcfg/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ var _ = Describe("query", func() {

When("creating new valid query parameters", func() {
BeforeEach(func() {
q, err = componentcfg.NewQueryParameters("process=true&a=aaa&b=123&C_D3=C,C,C")
q, err = componentcfg.NewQueryParameters("process=true&a=aaa&b=123&C_D3=C,C,C&detectors=[\"MCH\",\"MID\"]")
})
It("should be parsed without reporting errors", func() {
Expect(err).To(BeNil())
Expand All @@ -215,6 +215,7 @@ var _ = Describe("query", func() {
Expect(q.VarStack["a"]).To(Equal("aaa"))
Expect(q.VarStack["b"]).To(Equal("123"))
Expect(q.VarStack["C_D3"]).To(Equal("C,C,C"))
Expect(q.VarStack["detectors"]).To(Equal("[\"MCH\",\"MID\"]"))
})
})

Expand Down

0 comments on commit e2d7c9b

Please sign in to comment.