-
-
Notifications
You must be signed in to change notification settings - Fork 105
Closed
Description
When shard.yml contains duplicate keys for example two entries called dependencies
, the spec parser concatenates the values:
yaml = <<-YAML
name: foo
version: 0.1.0
dependencies:
foo:
github: foo/foo
dependencies:
bar:
github: bar/bar
YAML
spec = Shards::Spec.from_yaml yaml
spec.dependencies.map(&.name) # => ["foo", "bar"]
This is unexpected and differes from any other YAML parser where previous values are simply overriden. For example YAML.parse
behaves that way:
YAML.parse(yaml)["dependencies"].as_h.keys # => ["bar"]
As a result of this behaviour normalized YAML (for example passing yaml
through YAML.parse(yaml).to_yaml
parses differently than the ill-formed spec with duplicate keys.
I'd expect the parser to behave like other YAML parses and only use the last value. That's how it worked before #349. We could also consider to fails parsing such a a spec. Duplicate keys are clearly an error in the shard spec and should be fixed by the author. But issueing a warning is probably better.
Sija
Metadata
Metadata
Assignees
Labels
No labels