diff --git a/mmv1/api/type.go b/mmv1/api/type.go index fafe6922e161..84ccf8f9b40f 100644 --- a/mmv1/api/type.go +++ b/mmv1/api/type.go @@ -702,17 +702,7 @@ func (t Type) FWResourceType() string { // check :default_value, type: clazz // } -// Checks that all conflicting properties actually exist. -// This currently just returns if empty, because we don't want to do the check, since -// this list will have a full path for nested attributes. -// func (t *Type) check_conflicts() { -// check :conflicts, type: ::Array, default: [], item_type: ::String - -// return if @conflicts.empty? -// } - // Returns list of properties that are in conflict with this property. -// func (t *Type) conflicting() { func (t Type) Conflicting() []string { if t.ResourceMetadata == nil { return []string{} @@ -723,18 +713,7 @@ func (t Type) Conflicting() []string { return t.Conflicts } -// TODO rewrite: validation -// Checks that all properties that needs at least one of their fields actually exist. -// This currently just returns if empty, because we don't want to do the check, since -// this list will have a full path for nested attributes. -// func (t *Type) check_at_least_one_of() { -// check :at_least_one_of, type: ::Array, default: [], item_type: ::String - -// return if @at_least_one_of.empty? -// } - // Returns list of properties that needs at least one of their fields set. -// func (t *Type) at_least_one_of_list() { func (t Type) AtLeastOneOfList() []string { if t.ResourceMetadata == nil { return []string{} @@ -745,18 +724,7 @@ func (t Type) AtLeastOneOfList() []string { return t.AtLeastOneOf } -// TODO rewrite: validation -// Checks that all properties that needs exactly one of their fields actually exist. -// This currently just returns if empty, because we don't want to do the check, since -// this list will have a full path for nested attributes. -// func (t *Type) check_exactly_one_of() { -// check :exactly_one_of, type: ::Array, default: [], item_type: ::String - -// return if @exactly_one_of.empty? -// } - // Returns list of properties that needs exactly one of their fields set. -// func (t *Type) exactly_one_of_list() { func (t Type) ExactlyOneOfList() []string { if t.ResourceMetadata == nil { return []string{} @@ -767,16 +735,6 @@ func (t Type) ExactlyOneOfList() []string { return t.ExactlyOneOf } -// TODO rewrite: validation -// Checks that all properties that needs required with their fields actually exist. -// This currently just returns if empty, because we don't want to do the check, since -// this list will have a full path for nested attributes. -// func (t *Type) check_required_with() { -// check :required_with, type: ::Array, default: [], item_type: ::String - -// return if @required_with.empty? -// } - // Returns list of properties that needs required with their fields set. func (t Type) RequiredWithList() []string { if t.ResourceMetadata == nil { diff --git a/mmv1/templates/terraform/schema_property.go.tmpl b/mmv1/templates/terraform/schema_property.go.tmpl index b477bf345e50..14e1ae34c212 100644 --- a/mmv1/templates/terraform/schema_property.go.tmpl +++ b/mmv1/templates/terraform/schema_property.go.tmpl @@ -167,16 +167,16 @@ Default value: {{ .ItemType.DefaultValue -}} {{ if not (eq .DefaultValue nil ) -}} Default: {{ .GoLiteral .DefaultValue -}}, {{ end -}} -{{ if or .Conflicting .Conflicts -}} +{{ if .Conflicting -}} ConflictsWith: {{ .GoLiteral (.GetPropertySchemaPathList .Conflicting) -}}, {{ end -}} -{{ if or .AtLeastOneOfList .AtLeastOneOf -}} +{{ if .AtLeastOneOfList -}} AtLeastOneOf: {{ .GoLiteral (.GetPropertySchemaPathList .AtLeastOneOfList) -}}, {{ end -}} -{{ if or .ExactlyOneOfList .ExactlyOneOf -}} +{{ if .ExactlyOneOfList -}} ExactlyOneOf: {{ .GoLiteral (.GetPropertySchemaPathList .ExactlyOneOfList) -}}, {{ end -}} -{{ if or .RequiredWithList .RequiredWith -}} +{{ if .RequiredWithList -}} RequiredWith: {{ .GoLiteral (.GetPropertySchemaPathList .RequiredWithList) -}}, {{ end -}} },