Documentation
¶
Overview ¶
Package yaml reads a file of a module, YAML 1.2.2 under its Core schema, into a JSON value, and refuses a file that breaks a rule yaml.*, naming the rule and its place, or that is not YAML 1.2.2 at all.
go.yaml.in/yaml/v4 parses the file into its tree of nodes. It keeps some of YAML 1.1 and lets through some of what YAML 1.2.2 refuses, so passes of this package go around it: text.go before the parse, errors.go on its errors, walk.go over its tree for the rules, and layout.go over its tree for what YAML 1.2.2 refuses and v4 reads all the same. A test holds each of them.
Index ¶
Constants ¶
const ( RuleEncoding = "yaml.encoding" RulePrintable = "yaml.printable" RuleSingleDocument = "yaml.single-document" RuleNoDirectives = "yaml.no-directives" RuleNoAnchors = "yaml.no-anchors" RuleNoTags = "yaml.no-tags" RuleStringKeys = "yaml.string-keys" RuleUniqueKeys = "yaml.unique-keys" RuleJSONScalars = "yaml.json-scalars" RulePlainStrings = "yaml.plain-strings" RuleCharacters = "yaml.characters" )
The IDs of the rules yaml.* of the format.
Variables ¶
var Rules = []string{ RuleEncoding, RulePrintable, RuleSingleDocument, RuleNoDirectives, RuleNoAnchors, RuleNoTags, RuleStringKeys, RuleUniqueKeys, RuleJSONScalars, RulePlainStrings, RuleCharacters, }
Rules are the IDs of the rules yaml.*, in the order the format gives them.
Functions ¶
Types ¶
type Breach ¶
type Breach struct {
Rule string
// The place in the file as written: the line and the column, both from 1. The column counts
// characters, a byte order mark among them, and a byte that is no part of a UTF-8 character
// counts as one.
Line, Column int
Message string
}
A Breach is one reason a file is refused: a rule it breaks, or, when Rule is empty, that it is not YAML 1.2.2 at all. The format gives that refusal no ID: a file that is not YAML is no module file, whatever its rules say.