MCPcopy Create free account
hub / github.com/bufbuild/buf / parseMessageEncoding

Function parseMessageEncoding

private/buf/buffetch/ref_parser.go:819–832  ·  view source on GitHub ↗
(format string)

Source from the content-addressed store, hash-verified

817}
818
819func parseMessageEncoding(format string) (MessageEncoding, error) {
820 switch format {
821 case formatBin, formatBinpb, formatBingz:
822 return MessageEncodingBinpb, nil
823 case formatJSON, formatJSONGZ:
824 return MessageEncodingJSON, nil
825 case formatTxtpb:
826 return MessageEncodingTxtpb, nil
827 case formatYAML:
828 return MessageEncodingYAML, nil
829 default:
830 return 0, fmt.Errorf("invalid format for message: %q", format)
831 }
832}
833
834// TODO FUTURE: this is a terrible heuristic, and we shouldn't be using what amounts
835// to heuristics here (technically this is a documentable rule, but still)

Callers 4

GetRefMethod · 0.85
GetRefForInputConfigMethod · 0.85
GetMessageRefMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…