CheckType checks the type of `node` against this MapItemType. If `node` is not a yamlmeta.MapItem, `chk` contains a violation describing this mismatch If this map item's value is a scalar, checks its type against this MapItemType.ValueType
(node yamlmeta.Node)
| 138 | // If `node` is not a yamlmeta.MapItem, `chk` contains a violation describing this mismatch |
| 139 | // If this map item's value is a scalar, checks its type against this MapItemType.ValueType |
| 140 | func (t *MapItemType) CheckType(node yamlmeta.Node) TypeCheck { |
| 141 | chk := TypeCheck{} |
| 142 | mapItem, ok := node.(*yamlmeta.MapItem) |
| 143 | if !ok { |
| 144 | chk.Violations = append(chk.Violations, NewMismatchedTypeAssertionError(node, t)) |
| 145 | return chk |
| 146 | } |
| 147 | |
| 148 | if _, isNode := mapItem.Value.(yamlmeta.Node); !isNode { |
| 149 | valChk := t.ValueType.CheckType(mapItem) // ScalarType checks mapItem.Value |
| 150 | if valChk.HasViolations() { |
| 151 | chk.Violations = append(chk.Violations, valChk.Violations...) |
| 152 | } |
| 153 | } |
| 154 | return chk |
| 155 | } |
| 156 | |
| 157 | // CheckType checks the type of `node` against this ArrayType |
| 158 | // |
nothing calls this directly
no test coverage detected