in mmv1/api/type.go [300:351]
func (t *Type) SetDefault(r *Resource) {
t.ResourceMetadata = r
if t.UpdateVerb == "" {
t.UpdateVerb = t.ResourceMetadata.UpdateVerb
}
switch {
case t.IsA("Array"):
t.ItemType.Name = t.Name
t.ItemType.ParentName = t.Name
t.ItemType.ParentMetadata = t
t.ItemType.SetDefault(r)
case t.IsA("Map"):
if t.KeyExpander == "" {
t.KeyExpander = "tpgresource.ExpandString"
}
t.ValueType.ParentName = t.Name
t.ValueType.ParentMetadata = t
t.ValueType.SetDefault(r)
case t.IsA("NestedObject"):
if t.Name == "" {
t.Name = t.ParentName
}
if t.Description == "" {
t.Description = "A nested object resource."
}
for _, p := range t.Properties {
p.ParentMetadata = t
p.SetDefault(r)
}
case t.IsA("ResourceRef"):
if t.Name == "" {
t.Name = t.Resource
}
if t.Description == "" {
t.Description = fmt.Sprintf("A reference to %s resource", t.Resource)
}
case t.IsA("Fingerprint"):
// Represents a fingerprint. A fingerprint is an output-only
// field used for optimistic locking during updates.
// They are fetched from the GCP response.
t.Output = true
default:
}
if t.ApiName == "" {
t.ApiName = t.Name
}
}