Re: Option to enforce unique map keys
Ingy dot Net <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CAHJtQJ5XkeZqRo4R3XucAJMKhQ3J8+-tc_L0P0J2YGiGPtM8PQ@mail.gmail.com> |
I just wanted to add some information that doesn't seem to be getting considered. The transformation of YAML from text to memory objects, is called "Load"ing and involves a stack of distinct layers. Likely: Reader→Lexer→Parser→Composer→Constructor. The spec is trying to say that the data model of YAML "mappings" does not account for duplicate keys. Detection of duplicate keys can't really be detected by the parser. This is for a couple reasons: 1. It is not realistic for a parser to keep keys as state. A parser looks at a token stream and generates events. 2. Not all keys are strings, or numbers. A key can be any graph node (including a mapping or sequence). 3. Even when keys are strings they can be different and be duplicate. ie: 12: dozen XII: Roman dozen Those can become duplicate keys up the stack. Thus this detection has to happen further up the stack. That's why the implementations built over libyaml can't rely on libyaml to report duplicate keys as errors. Not possible. In streaming processing of YAML, stuff doesn't go any higher up the stack than the parser. So it would be the application's responsibility to detect the duplicates. On Tue, Sep 23, 2014 at 8:35 PM, Zenaan Harkness <[email protected]> wrote: > On 9/24/14, Mark Laff <[email protected]> wrote: > > While the YAML spec specifies that Mapping node keys must be unique [1.2 > > spec, section 3.2.1.1 Nodes], it seems like duplicate keys are not > flagged. > > Parsers "should" match the spec by default and optionally provide > options to bend to something outside the spec, IMEHO. > > > For example: > ... > > I suggest adding an option to the Yaml parser to > > I don't know which library you are referring to. Does it have a > bug-report page or email address? > > Good luck, > Zenaan > > -- > Banned for life from Debian, for suggesting Debian's CoC > is being swung in our faces a little too vigorously. > > > ------------------------------------------------------------------------------ > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer > > http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk > _______________________________________________ > Yaml-core mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/yaml-core > ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Yaml-core mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/yaml-core