Compare commits

...

2 Commits

Author SHA1 Message Date
9cc0abf9e0 v0.0.278 DYN-166 bugfix jsonfilter
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 52s
2023-10-05 12:54:07 +02:00
7c40bcfd3c v0.0.277 DYN-166 json marshal filter in ginext Write
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 54s
2023-10-05 12:00:51 +02:00
3 changed files with 8 additions and 4 deletions

View File

@@ -27,7 +27,11 @@ func (j jsonHTTPResponse) Write(g *gin.Context) {
for _, v := range j.headers {
g.Header(v.Key, v.Val)
}
g.Render(j.statusCode, json.GoJsonRender{Data: j.data, NilSafeSlices: true, NilSafeMaps: true})
var f *string
if jsonfilter := g.GetString("goext.jsonfilter"); jsonfilter != "" {
f = &jsonfilter
}
g.Render(j.statusCode, json.GoJsonRender{Data: j.data, NilSafeSlices: true, NilSafeMaps: true, Filter: f})
}
func (j jsonHTTPResponse) WithHeader(k string, v string) HTTPResponse {

View File

@@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.276"
const GoextVersion = "0.0.278"
const GoextVersionTimestamp = "2023-10-05T10:59:20+0200"
const GoextVersionTimestamp = "2023-10-05T12:54:07+0200"

View File

@@ -1326,7 +1326,7 @@ func typeFields(t reflect.Type) structFields {
var jsonfilter []string
jsonfilterTag := sf.Tag.Get("jsonfilter")
if isValidTag(jsonfilterTag) {
if jsonfilterTag != "" && jsonfilterTag != "-" {
jsonfilter = strings.Split(jsonfilterTag, ",")
}