(foundKeys []interface{}, chk TypeCheck, mapNode *yamlmeta.Map)
| 60 | } |
| 61 | |
| 62 | func (m *MapType) applySchemaDefaults(foundKeys []interface{}, chk TypeCheck, mapNode *yamlmeta.Map) { |
| 63 | for _, item := range m.Items { |
| 64 | if contains(foundKeys, item.Key) { |
| 65 | continue |
| 66 | } |
| 67 | |
| 68 | val := item.GetDefaultValue() |
| 69 | childCheck := item.AssignTypeTo(val.(*yamlmeta.MapItem)) |
| 70 | chk.Violations = append(chk.Violations, childCheck.Violations...) |
| 71 | err := mapNode.AddValue(val) |
| 72 | if err != nil { |
| 73 | panic(fmt.Sprintf("Internal inconsistency: adding map item: %s", err)) |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func contains(haystack []interface{}, needle interface{}) bool { |
| 79 | for _, key := range haystack { |
no test coverage detected