jsontag

package
v1.18.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package jsontag resolves a struct field's name on the wire.

It exists so that rule lives in ONE place. zip reads it three ways — from reflect when building a schema, from reflect when binding path params, and from the AST when cmd/zipdoc extracts field documentation — and a spec that names a field differently from the decoder that reads it is precisely the drift the generator exists to kill. Different inputs, same rule.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Name

func Name(goName, tag string) string

Name is the JSON name of a field declared as goName with the given `json` struct tag value (the tag's value, not the whole tag literal).

The tag's name wins; an empty or options-only tag (`json:",omitempty"`) leaves the Go name. "-" is returned as-is rather than resolved, so a caller can tell "this field is omitted" from "this field is named -".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL