CheckType checks the type of `node` against this DocumentType. If `node` is not a yamlmeta.Document, `chk` contains a violation describing this mismatch If this document's value is a scalar, checks its type against this DocumentType.ValueType
(node yamlmeta.Node)
| 76 | // If `node` is not a yamlmeta.Document, `chk` contains a violation describing this mismatch |
| 77 | // If this document's value is a scalar, checks its type against this DocumentType.ValueType |
| 78 | func (t *DocumentType) CheckType(node yamlmeta.Node) TypeCheck { |
| 79 | chk := TypeCheck{} |
| 80 | doc, ok := node.(*yamlmeta.Document) |
| 81 | if !ok { |
| 82 | chk.Violations = append(chk.Violations, NewMismatchedTypeAssertionError(node, t)) |
| 83 | return chk |
| 84 | } |
| 85 | |
| 86 | if _, isNode := doc.Value.(yamlmeta.Node); !isNode { |
| 87 | valChk := t.ValueType.CheckType(doc) // ScalarType checks doc.Value |
| 88 | if valChk.HasViolations() { |
| 89 | chk.Violations = append(chk.Violations, valChk.Violations...) |
| 90 | } |
| 91 | } |
| 92 | return chk |
| 93 | } |
| 94 | |
| 95 | // CheckType checks the type of `node` against this MapType. |
| 96 | // |
nothing calls this directly
no test coverage detected