Commit 71c52dc 1 parent e47d129 commit 71c52dc Copy full SHA for 71c52dc
File tree 1 file changed +32
-16
lines changed
1 file changed +32
-16
lines changed Original file line number Diff line number Diff line change @@ -831,26 +831,42 @@ func (r *ResourceDefinition) Finalize() {
831
831
}
832
832
}
833
833
// 2. Create implicit action parameters for path wildcards that dont' have one
834
- for _ , r := range a .Routes {
835
- wcs := ExtractWildcards (r .FullPath ())
836
- for _ , wc := range wcs {
834
+ for _ , ro := range a .Routes {
835
+ for _ , wc := range ro .Params () {
837
836
found := false
838
- var o Object
839
- if all := a .Params ; all != nil {
840
- o = all .Type .ToObject ()
841
- } else {
842
- o = Object {}
843
- a .Params = & AttributeDefinition {Type : o }
844
- }
845
- for n := range o {
846
- if n == wc {
847
- found = true
848
- break
837
+ search := func (params * AttributeDefinition ) {
838
+ if params == nil {
839
+ return
840
+ }
841
+ for n , att := range params .Type .ToObject () {
842
+ if n == wc {
843
+ if a .Params == nil {
844
+ a .Params = & AttributeDefinition {Type : Object {}}
845
+ }
846
+ a .Params .Type .ToObject ()[wc ] = att
847
+ found = true
848
+ break
849
+ }
849
850
}
850
851
}
851
- if ! found {
852
- o [wc ] = & AttributeDefinition {Type : String }
852
+ search (a .Params )
853
+ parent := r
854
+ for ! found && parent != nil {
855
+ bp := parent .BaseParams
856
+ parent = parent .Parent ()
857
+ search (bp )
858
+ }
859
+ if found {
860
+ continue
861
+ }
862
+ search (Design .BaseParams )
863
+ if found {
864
+ continue
865
+ }
866
+ if a .Params == nil {
867
+ a .Params = & AttributeDefinition {Type : Object {}}
853
868
}
869
+ a .Params .Type .ToObject ()[wc ] = & AttributeDefinition {Type : String }
854
870
}
855
871
}
856
872
// 3. Compute QueryParams from Params and set all path params as non zero attributes
You can’t perform that action at this time.
0 commit comments