Add json_name fields to proto for complex names (#27)

This was generating fine before but it makes it explicit in the proto
and it avoids weirdness where the protobuf tag will say a name is
something like requestId where the json tag says it's request_id. This
way they line up.

One thing not honoring this properly is TraceId. I don't know why the
JSON tag being generated doesn't match even when explicitly set here.
For now I'm just manually fixing it.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-05-05 14:08:13 -04:00
1 parent 1f0748a8c3
commit f36f25a23b
23 files changed
+775 -801

No files matched your search

+3 -1
View File
@@ -224,7 +224,9 @@ func parsePBs() {
}
TAGMODIFY:
st.Fields.List[i].Tag.Value = "`" + regex.FindString(st.Fields.List[i].Tag.Value) + "`"
// TraceId needs to be handled differently because it's a
// specific value used by OpenTelemetry
st.Fields.List[i].Tag.Value = "`" + strings.Replace(regex.FindString(st.Fields.List[i].Tag.Value), "trace_id", "TraceId", 1) + "`"
}
}), inAst)