Skip to content

Commit 3a4d4fe

Browse files
authored
restore strict validation for several objects (#15733)
1 parent 9317eab commit 3a4d4fe

File tree

3 files changed

+0
-38
lines changed

3 files changed

+0
-38
lines changed

mmv1/api/resource.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"text/template"
2626

2727
"github.com/golang/glog"
28-
"gopkg.in/yaml.v3"
2928

3029
"github.com/GoogleCloudPlatform/magic-modules/mmv1/api/product"
3130
"github.com/GoogleCloudPlatform/magic-modules/mmv1/api/resource"
@@ -416,18 +415,6 @@ type TGCResource struct {
416415
CaiAssetNameFormat string `yaml:"cai_asset_name_format,omitempty"`
417416
}
418417

419-
func (r *Resource) UnmarshalYAML(value *yaml.Node) error {
420-
type resourceAlias Resource
421-
aliasObj := (*resourceAlias)(r)
422-
423-
err := value.Decode(aliasObj)
424-
if err != nil {
425-
return err
426-
}
427-
428-
return nil
429-
}
430-
431418
// // MarshalYAML implements a custom marshaller to omit dynamic default values.
432419
func (r *Resource) MarshalYAML() (interface{}, error) {
433420
type resourceAlias Resource

mmv1/api/resource/sample.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,6 @@ type Sample struct {
9797
TGCSkipTest string `yaml:"tgc_skip_test,omitempty"`
9898
}
9999

100-
// Set default value for fields
101-
func (s *Sample) UnmarshalYAML(unmarshal func(any) error) error {
102-
type sampleAlias Sample
103-
aliasObj := (*sampleAlias)(s)
104-
105-
err := unmarshal(aliasObj)
106-
if err != nil {
107-
return err
108-
}
109-
110-
return nil
111-
}
112-
113100
func (s *Sample) TestSampleSlug(productName, resourceName string) string {
114101
ret := fmt.Sprintf("%s%s_%sExample", productName, resourceName, google.Camelize(s.Name, "lower"))
115102
return ret

mmv1/api/resource/step.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,6 @@ type Step struct {
113113
PrimaryResourceId string `yaml:"-"`
114114
}
115115

116-
func (s *Step) UnmarshalYAML(unmarshal func(any) error) error {
117-
type stepAlias Step
118-
aliasObj := (*stepAlias)(s)
119-
120-
err := unmarshal(aliasObj)
121-
if err != nil {
122-
return err
123-
}
124-
125-
return nil
126-
}
127-
128116
func (s *Step) TestStepSlug(productName, resourceName string) string {
129117
ret := fmt.Sprintf("%s%s_%sExample", productName, resourceName, google.Camelize(s.Name, "lower"))
130118
return ret

0 commit comments

Comments
 (0)