MCPcopy
hub / github.com/danielgtaylor/huma / jsonName

Function jsonName

huma.go:379–385  ·  view source on GitHub ↗

jsonName extracts the JSON name from a struct field or converts the field name to lowercase if no JSON tag is present.

(field reflect.StructField)

Source from the content-addressed store, hash-verified

377// jsonName extracts the JSON name from a struct field or converts the field name
378// to lowercase if no JSON tag is present.
379func jsonName(field reflect.StructField) string {
380 name := strings.ToLower(field.Name)
381 if jsonName := field.Tag.Get("json"); jsonName != "" {
382 name = strings.Split(jsonName, ",")[0]
383 }
384 return name
385}
386
387// everyPB traverses and processes a value using a path, building paths with
388// PathBuffer, and applying a function to leaf nodes.

Callers 2

everyPBMethod · 0.85
setDeepObjectValueFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…