Since tag of Node is resolved by Resolver, If Resolver is different, tag will also be different.
try Yams.compose(yaml: "200")!.tag // tag:yaml.org,2002:int
try Yams.compose(yaml: "200", .basic)!.tag // tag:yaml.org,2002:str
Yams uses not only values but also tags for checking equality of Node.
let node1 = try Yams.compose(yaml: "200")
let node2 = try Yams.compose(yaml: "200", .basic)
node1 == node2 // false
Since current implementation of subscript(string:) creates Node from String with default Resolver, if target Node has different Resolver, subscript will fail to lookup value.
Node("200").tag // tag:yaml.org,2002:int
let yaml = "200: value"
let node3 = try Yams.compose(yaml: yaml) // "200" is resolved to tag:yaml.org,2002:int
let key1 = Node("200", Tag(.int))
let key2 = Node("200", Tag(.str))
node3?[key1]?.string // "value"
node3?[key2]?.string // nil
node3?["200"]?.string // "value"
let node4 = try Yams.compose(yaml: yaml, .basic) // "200" is resolved to tag:yaml.org,2002:str
node4?[key1]?.string // nil
node4?[key2]?.string // "value"
node4?["200"]?.string // nil
This behavior causes the issue #99
Since
tagofNodeis resolved byResolver, IfResolveris different,tagwill also be different.Yams uses not only values but also tags for checking equality of
Node.Since current implementation of
subscript(string:)createsNodefromStringwith defaultResolver, if targetNodehas differentResolver,subscriptwill fail to lookup value.This behavior causes the issue #99