Files
releases/util
Stephan Renatus 61b8c1463d util/Unmarshal: if it's JSON, skip YAMLtoJSON (#4681)
This helper accepts JSON or YAML, and used to do this:

1. For YAML input, yaml.YAMLToJSON would parse it as yaml, marshal it to
   JSON, and pass that back out to be passed to UnmarshalJSON
2. For JSON input, yaml.YAMLToJSON would also parse it as yaml, marshal it
   to JSON, and pass that back out to UnmarshalJSON

Issue #4673 has shown that the theoretical "superset" propery of YAML doesn't
seem to hold in all cases.

So now, we'll do this:

1. For YAML input, yaml.YAMLToJSON would parse it as yaml, marshal it to
   JSON, and pass that back out to be passed to UnmarshalJSON
2. For JSON input, json.Valid will determine that it's JSON, and we'll
   feed it into UnmarshalJSON as-is.

The YAML path (1.) still seems suboptimal, but I also suspect that JSON is
more common. Also, this change shouldn't make the YAML path much worse:
determining that yaml string isn't valid JSON should be quick.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-05-12 20:30:10 +02:00
..
2021-02-11 19:59:54 +01:00
2019-07-31 03:43:38 -04:00
2016-08-02 16:57:15 -07:00
2017-04-26 15:04:48 -07:00
2019-09-27 09:55:11 -04:00
2017-04-26 15:04:48 -07:00
2020-08-06 14:34:27 -07:00