File size: 1,021 Bytes
1f10f31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- a/chi-middleware.tmpl
+++ b/chi-middleware.tmpl
@@ -77,11 +77,21 @@
         }{{end}}
       {{end}}
       {{if .IsStyled}}
+      {{- /* For "filter" deepObject params, use the custom filter parser which
+             correctly handles all filter types including union types. */ -}}
+      {{- if and (eq .ParamName "filter") (eq .Style "deepObject") }}
+      err = filters.Parse(r.URL.Query(), &params.{{.GoName}})
+      if err != nil {
+        siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err})
+        return
+      }
+      {{- else }}
       err = runtime.BindQueryParameterWithOptions("{{.Style}}", {{.Explode}}, {{.Required}}, "{{.ParamName}}", r.URL.Query(), &params.{{.GoName}}, runtime.BindQueryParameterOptions{Type: "{{.SchemaType}}", Format: "{{.SchemaFormat}}"})
       if err != nil {
         siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "{{.ParamName}}", Err: err})
         return
       }
+      {{- end }}
       {{end}}
   {{end}}