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

Function newMessageRefParser

private/buf/buffetch/ref_parser.go:92–129  ·  view source on GitHub ↗
(logger *slog.Logger, options ...MessageRefParserOption)

Source from the content-addressed store, hash-verified

90}
91
92func newMessageRefParser(logger *slog.Logger, options ...MessageRefParserOption) *refParser {
93 messageRefParserOptions := newMessageRefParserOptions()
94 for _, option := range options {
95 option(messageRefParserOptions)
96 }
97 return &refParser{
98 logger: logger,
99 fetchRefParser: internal.NewRefParser(
100 logger,
101 internal.WithRawRefProcessor(newProcessRawRefMessage(messageRefParserOptions.defaultMessageEncoding)),
102 internal.WithSingleFormat(formatBin),
103 internal.WithSingleFormat(formatBinpb),
104 internal.WithSingleFormat(
105 formatJSON,
106 internal.WithSingleCustomOptionKey(useProtoNamesKey),
107 internal.WithSingleCustomOptionKey(useEnumNumbersKey),
108 ),
109 internal.WithSingleFormat(formatTxtpb),
110 internal.WithSingleFormat(
111 formatYAML,
112 internal.WithSingleCustomOptionKey(useProtoNamesKey),
113 internal.WithSingleCustomOptionKey(useEnumNumbersKey),
114 ),
115 internal.WithSingleFormat(
116 formatBingz,
117 internal.WithSingleDefaultCompressionType(
118 internal.CompressionTypeGzip,
119 ),
120 ),
121 internal.WithSingleFormat(
122 formatJSONGZ,
123 internal.WithSingleDefaultCompressionType(
124 internal.CompressionTypeGzip,
125 ),
126 ),
127 ),
128 }
129}
130
131func newSourceRefParser(logger *slog.Logger) *refParser {
132 return &refParser{

Callers 1

NewMessageRefParserFunction · 0.85

Calls 8

NewRefParserFunction · 0.92
WithRawRefProcessorFunction · 0.92
WithSingleFormatFunction · 0.92
optionStruct · 0.85
newProcessRawRefMessageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…