File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,17 @@ type {{ .GetName | SanitiseName }} {{ . | SanitiseType }}
1111 {{ if eq ($schema | SanitiseType) " struct" -}}
1212 {{ $name | ToTitle }} {{ $schema .GetName | SanitiseName }}
1313 {{- else -}}
14- {{ $name | ToTitle }} {{ $schema | SanitiseType }} ` json:"{{ $name }}"`
14+ {{- $required := false }}
15+ {{- range $requiredProperty := $schema .Required }}
16+ {{- if eq $name $requiredProperty }}
17+ {{- $required = true }}
18+ {{- end }}
19+ {{- end }}
20+ {{- if eq $required false -}}
21+ {{ $name | ToTitle }} {{ if eq ($schema | SanitiseType) " bool" }}*{{ end }}{{ $schema | SanitiseType }} ` json:"{{ $name }},omitempty"`
22+ {{- else }}
23+ {{ $name | ToTitle }} {{ $schema | SanitiseType }} ` json:"{{ $name }}"`
24+ {{- end }}
1525 {{- end }}
1626 {{- end }}
1727}
You can’t perform that action at this time.
0 commit comments