Description
In PyYAML, I can use the add_multi_constructor
feature to allow me to define a constructor for multiple tags. I am using it to handle any unknown tags. For example, I could use this to deserialize the document
thing1: !someTag asdf
thing2: !someOtherTag fdsa
into the JS structure
{
thing1: UnknownTag { tag: 'someTag', value: 'asdf' },
thing2: UnknownTag { tag: 'someOtherTag', value: 'fdsa' }
}
and be able to re-serialize that structure back into equivalent yaml.
My use case is to read and modify a tiny part of a big yaml file that has a bunch of domain-specific tags in it. I don't care how the tags are resolved as I'm not reading that part of the file, but currently with js-yaml I can't read it at all because to parse the file in the first place results in an unknown tag error. Even if I set it to skip unknown tags, I can't re-serialize the modified docjument.
This is fine with PyYAML as I can use add_multi_constructor
as defined above to handle any unknown tags, but as far as I can tell this behvaiour is impossible to achieve with js-yaml.