You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crystal's YAML parser supports the failsafe schema, but it's quite hidden in YAML::Schema::FailSafe and not mentioned anywhere else. In contrast, the Core schema is prominently used by YAML.parse.
Now the API docs for YAML should certainly at least mention this alternative schema.
But I think there should also be an easier option for using it. Compared to the short code YAML.parse(yaml), YAML::Schema::FailSafe.parse(yaml) is quite bulky and resides two nested namespaces deeper.
I'd like to introduce an easily accessible API for the failsafe schema directly on YAML for convenience.
Options for this are:
an additional overload which accepts a parameter: YAML.parse(yaml, schema: :fail_safe)
a separate method: YAML.parse_fail_safe(yaml)
Failsafe is the smallest sibling of the YAML schemas and a tiny subset of the Core schema. It only supports mapping, list, and string types. This makes it much more sane than its bigger siblings (for example, it doesn't interpret Norway as a Boolean). It's entirely sufficient for many use cases of parsing a dynamic YAML structure (YAML::Any). I think it should often be preferred over the Core schema.
The text was updated successfully, but these errors were encountered:
Crystal's YAML parser supports the failsafe schema, but it's quite hidden in
YAML::Schema::FailSafe
and not mentioned anywhere else. In contrast, the Core schema is prominently used byYAML.parse
.Now the API docs for
YAML
should certainly at least mention this alternative schema.But I think there should also be an easier option for using it. Compared to the short code
YAML.parse(yaml)
,YAML::Schema::FailSafe.parse(yaml)
is quite bulky and resides two nested namespaces deeper.I'd like to introduce an easily accessible API for the failsafe schema directly on
YAML
for convenience.Options for this are:
YAML.parse(yaml, schema: :fail_safe)
YAML.parse_fail_safe(yaml)
Failsafe is the smallest sibling of the YAML schemas and a tiny subset of the Core schema. It only supports mapping, list, and string types. This makes it much more sane than its bigger siblings (for example, it doesn't interpret Norway as a Boolean). It's entirely sufficient for many use cases of parsing a dynamic YAML structure (
YAML::Any
). I think it should often be preferred over the Core schema.The text was updated successfully, but these errors were encountered: