@@ -464,6 +464,15 @@ func fieldName(r *registry.Registry) func(name string) string {
464464 }
465465}
466466
467+ func renderParts (fieldName string , fieldNameFn func (name string ) string ) string {
468+ fieldNameParts := strings .Split (fieldName , "." )
469+ renderedParts := make ([]string , 0 , len (fieldNameParts ))
470+ for _ , part := range fieldNameParts {
471+ renderedParts = append (renderedParts , fmt .Sprintf (`["%s"]` , fieldNameFn (part )))
472+ }
473+ return fmt .Sprintf ("${req%s}" , strings .Join (renderedParts , "" ))
474+ }
475+
467476func renderURL (r * registry.Registry ) func (method data.Method ) string {
468477 fieldNameFn := fieldName (r )
469478 return func (method data.Method ) string {
@@ -475,10 +484,11 @@ func renderURL(r *registry.Registry) func(method data.Method) string {
475484 log .Debugf ("url matches %v" , matches )
476485 for _ , m := range matches {
477486 expToReplace := m [0 ]
478- fieldName := fieldNameFn (m [1 ])
479- part := fmt .Sprintf (`${req["%s"]}` , fieldName )
487+ // cleanup m[1] if the pattern is {fieldname=resources/*}
488+ cleanedFieldName := strings .Split (m [1 ], "=" )[0 ]
489+ part := renderParts (cleanedFieldName , fieldNameFn )
480490 methodURL = strings .ReplaceAll (methodURL , expToReplace , part )
481- fieldsInPath = append (fieldsInPath , fmt .Sprintf (`"%s"` , fieldName ))
491+ fieldsInPath = append (fieldsInPath , fmt .Sprintf (`"%s"` , cleanedFieldName ))
482492 }
483493 }
484494 urlPathParams := fmt .Sprintf ("[%s]" , strings .Join (fieldsInPath , ", " ))
0 commit comments