Using reference and overriding key will result to exception

Issue #55 resolved
Petros Makris
created an issue

According to https://en.wikipedia.org/wiki/YAML#Repeated_nodes you can do the following in YAML

- step:  &id001                  # defines anchor label &id001
    instrument:      Lasik 2000
    pulseEnergy:     5.4
    pulseDuration:   12
    repetition:      1000
    spotSize:        1mm

- step: &id002
    instrument:      Lasik 2000
    pulseEnergy:     5.0
    pulseDuration:   10
    repetition:      500
    spotSize:        2mm

- step: *id001                   # refers to the first step (with anchor &id001)
- step: *id002                   # refers to the second step
- step: *id001
    spotSize: 2mm             # redefines just this key, refers rest from &id001
- step: *id002

Although when you try to override spotSize key of step with reference *id001 you get

yaml.parser.ParserError: while parsing a block mapping
  in "C:\Users\...\test.yaml", line 1, column 1
expected <block end>, but found '<block mapping start>'
  in "C:\Users\...\test.yaml", line 29, column 5

Could somebody give a hint on how to implement that and would that be merged if I did that?

Comments (2)

  1. Log in to comment