api/templates: vendor structfield template

Taken verbatim from
eee6eaf67f/generator/templates/structfield.gotmpl
so the alterations from the upstream template can be easily diffed.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider
2025-08-26 19:04:47 -04:00
parent 6da8589ebe
commit c208f90796

View File

@@ -0,0 +1,41 @@
{{ define "structfield" }}
{{- if not $.IsBaseType -}}
// {{ template "docstring" . }}
{{- template "propertyValidationDocString" .}}
{{- end}}
{{ pascalize .Name}} {{ template "schemaType" . }} {{ .PrintTags }}
{{ end }}
{{- define "tuplefield" }}
{{- if not $.IsBaseType -}}
// {{ template "docstring" . }}
{{- template "propertyValidationDocString" .}}
{{ end }}
{{- pascalize .Name}} {{ template "schemaType" . }} `json:"-"
{{- if .CustomTag }} {{ .CustomTag }}{{ end }}` // custom serializer
{{ end }}
{{- define "structfieldIface" }}
{{- if not $.IsBaseType -}}
// {{ template "docstring" . }}
{{- template "propertyValidationDocString" .}}
{{- end }}
{{ pascalize .Name}}() {{ template "schemaType" . }}
Set{{ pascalize .Name}}({{ template "schemaType" . }})
{{ end }}
{{ define "tuplefieldIface" }}
{{- if not $.IsBaseType -}}
// {{ template "docstring" . }}
{{- template "propertyValidationDocString" . }}
{{ end }}
{{- pascalize .Name}}() {{ template "schemaType" . }}
Set{{ pascalize .Name}}({{ template "schemaType" . }})
{{ end }}
{{- define "privstructfield" }}
{{- camelize .Name}}Field {{ template "schemaType" . }}
{{ end }}
{{- define "privtuplefield" }}
{{- camelize .Name}}Field {{ template "schemaType" . }}
{{ end }}