MCPcopy
hub / github.com/hasura/graphql-engine / JSON

Method JSON

cli/internal/projectmetadata/handler.go:345–353  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

343// the underlying type of struct fields might be yaml.Node
344// which might give unintended result
345func (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
355func (m Metadata) YAML() ([]byte, error) {
356 var op internalerrors.Op = "projectmetadata.Metadata.YAML"

Callers 7

MetadataAPIFunction · 0.80
MigrateAPIFunction · 0.80
SettingsAPIFunction · 0.80
SquashCreateAPIFunction · 0.80
SquashDeleteAPIFunction · 0.80
BuildJSONMetadataMethod · 0.80
TestGenMetadataFromMapFunction · 0.80

Calls 1

YAMLMethod · 0.95

Tested by 1

TestGenMetadataFromMapFunction · 0.64