JSON is a helper function which returns JSON representation of Metadata This exists because we cannot directly do a json.Marshal on Metadata because the underlying type of struct fields might be yaml.Node which might give unintended result
()
| 343 | // the underlying type of struct fields might be yaml.Node |
| 344 | // which might give unintended result |
| 345 | func (m Metadata) JSON() ([]byte, error) { |
| 346 | var op internalerrors.Op = "projectmetadata.Metadata.JSON" |
| 347 | yamlbs, err := m.YAML() |
| 348 | if err != nil { |
| 349 | return nil, internalerrors.E(op, err) |
| 350 | } |
| 351 | |
| 352 | return metadatautil.YAMLToJSON(yamlbs) |
| 353 | } |
| 354 | |
| 355 | func (m Metadata) YAML() ([]byte, error) { |
| 356 | var op internalerrors.Op = "projectmetadata.Metadata.YAML" |