From d9bfdff22704915630f6341efbd11ceac7f3315d Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Fri, 11 Feb 2022 13:09:11 +0000 Subject: [PATCH] feat(generate): allow for optional params BREAKING CHANGE: optional parameters are now marked as a pointer. --- generate/templates/globals.template | 2 +- generate/templates/resource.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generate/templates/globals.template b/generate/templates/globals.template index e83180f0a9..10c6b2452d 100644 --- a/generate/templates/globals.template +++ b/generate/templates/globals.template @@ -14,7 +14,7 @@ type {{.StructName}} struct { // {{$name}} AWS CloudFormation Property // Required: false // See: {{$property.Documentation}} - {{$prop_name}} {{if (or ($property.IsPolymorphic) ($property.IsCustomType) )}}*{{$iname}}.{{end}}{{$property.GoType $.ResourceName $.Basename $name}} `json:"{{$name}}{{if (not (and ($property.IsNumeric) ($property.Required)))}},omitempty{{end}}"` + {{$prop_name}} {{if (or ($property.IsPolymorphic) ($property.IsCustomType) )}}*{{$iname}}.{{else}}*{{end}}{{$property.GoType $.ResourceName $.Basename $name}} `json:"{{$name}}{{if (not ($property.Required))}},omitempty{{end}}"` {{end}} } diff --git a/generate/templates/resource.template b/generate/templates/resource.template index a984c313e2..6b8a40028f 100644 --- a/generate/templates/resource.template +++ b/generate/templates/resource.template @@ -25,7 +25,7 @@ type {{.StructName}} struct { // {{$name}} AWS CloudFormation Property // Required: {{$property.Required}} // See: {{$property.Documentation}} - {{$prop_name}} {{if (or ($property.IsPolymorphic) ($property.IsCustomType) )}}*{{end}}{{$property.GoType $.Name $.Basename $name}} `json:"{{$name}}{{if (not (and ($property.IsNumeric) ($property.Required)))}},omitempty{{end}}"` + {{$prop_name}} {{if (or ($property.IsPolymorphic) ($property.IsCustomType) (not ($property.Required)) )}}*{{end}}{{$property.GoType $.Name $.Basename $name}} `json:"{{$name}}{{if (not ($property.Required))}},omitempty{{end}}"` {{end}} {{if .HasUpdatePolicy }}// AWSCloudFormationUpdatePolicy represents a CloudFormation UpdatePolicy AWSCloudFormationUpdatePolicy *policies.UpdatePolicy `json:"-"`{{ end }}