crystal-lang / shards

Dependency manager for the Crystal language
Other
765 stars 102 forks source link

Spec: Allow empty scalar for mappings/sequences #451

Closed straight-shoota closed 3 years ago

straight-shoota commented 3 years ago

This patch allows empty scalars as values for mappings or sequences in shard.yml.

So this is considered a valid specification:

name: foo
version: 0.1.0
dependencies:

Previously, this caused a YAML parser error: Expected MAPPING_START but was SCALAR at line 3, column 15

There's no change to internal behaviour because empty mappings and sequences were already allowed (dependencies: {}). So this is just a simple UX feature that avoids errors when for example all dependencies are removed but the dependencies: key isn't. Both empty string and YAML null value (~) are accepted.