Skip to content

Commit 32e922a

Browse files
authored
Inherit query string parameters defined in API (goadesign#1818)
In all actions.
1 parent 4a68f4f commit 32e922a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

design/definitions.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1517,9 +1517,8 @@ func (a *ActionDefinition) AllParams() *AttributeDefinition {
15171517
res = res.Merge(p.CanonicalAction().PathParams())
15181518
} else {
15191519
res = res.Merge(a.Parent.PathParams())
1520-
res = res.Merge(Design.PathParams())
15211520
}
1522-
return res
1521+
return res.Merge(Design.Params)
15231522
}
15241523

15251524
// HasAbsoluteRoutes returns true if all the action routes are absolute.

design/definitions_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,18 @@ var _ = Describe("AllParams", func() {
365365
}
366366
})
367367

368-
It("AllParams does NOT return the query parameters of the parent resource canonical action or the API", func() {
369-
for _, p := range []string{"canquery", "pbasequery", "apiquery"} {
368+
It("AllParams does NOT return the query parameters of the parent resource canonical action", func() {
369+
for _, p := range []string{"canquery", "pbasequery"} {
370370
Ω(allParams).ShouldNot(HaveKey(p))
371371
}
372372
})
373373

374+
It("AllParams does return the query parameters of the parent API", func() {
375+
for _, p := range []string{"apiquery"} {
376+
Ω(allParams).Should(HaveKey(p))
377+
}
378+
})
379+
374380
It("PathParams returns the path parameters recursively", func() {
375381
Ω(pathParams).Should(HaveLen(5))
376382
for _, p := range []string{"path", "basepath", "canpath", "pbasepath", "apipath"} {

0 commit comments

Comments
 (0)