Skip to content

Use fork of ghodss/yaml to use 'on' as key in CampaignSpec

Warren Gifford requested to merge fix-on-keyword-in-yaml into campaign-spec-api-v1

Created by: mrnugget

As we noticed last week: we can't use on as a key in a CampaignSpec because yaml.YAMLToJSON would convert that on into a true and that in turn would fail when validated.

The solution here is to use a custom fork of ghodss/yaml that allows passing in a custom unmarshal-function which does not do the conversion.

The function we're passing in comes from the yaml.v3 library which changed its behavior when parsing boolean values (see https://github.com/ghodss/yaml/pull/65).

We lose the ability to use YAMLToJSONStrict since that only works with yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON schema validation gives us enough of a safety net for the rest.

Merge request reports

Loading