Skip to content

Commit

Permalink
refactor: improve fix using tdakkota suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
yawnak committed Oct 16, 2024
1 parent 4f5c7fb commit 418f83c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gen/_template/json/encode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if {{ $.Var }}.Set {
{{/* Encode value that implements jx.Encoder with respect to nil semantic */}}
{{- define "json/enc_value" -}}
{{- $t := $.Type -}}
{{- if or ($t.NilSemantic.Invalid) ($t.NilSemantic.Optional) -}}
{{- if or ($t.NilSemantic.Invalid) ($t.NilSemantic.Optional) }}
if {{ $.Var }} != nil {
{{- template "json/enc_field" $ }}
{{ $.Var }}.Encode(e)
Expand Down
2 changes: 1 addition & 1 deletion gen/_template/response_encode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func encode{{ $op.Name }}Response(response {{ $op.Responses.GoType }}, w http.Re
return errors.Wrap(err, "flush streaming")
}
{{- else }}
e := new(jx.Encoder);
e := new(jx.Encoder)
{{- template "json/enc" elem $type $var }}
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
Expand Down

0 comments on commit 418f83c

Please sign in to comment.