Documentation
¶
Overview ¶
Package jsonstrict provides target-aware JSON key validation shared by transport and persisted event decoders.
Index ¶
- func CheckNoDuplicateKeysFor(data []byte, target reflect.Type) error
- func CheckNoDuplicateKeysForSchema(data []byte, schema reflect.Type) error
- func FoldName(name string) string
- func FoldRune(r rune) rune
- func ObjectFields(target reflect.Type) (map[string]reflect.Type, bool)
- func ValidateUnicode(body []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckNoDuplicateKeysFor ¶
CheckNoDuplicateKeysFor rejects repeated object keys. When an object is decoded into a struct, keys are compared with encoding/json's case-folding rules so two spellings cannot silently target the same field.
func CheckNoDuplicateKeysForSchema ¶ added in v0.60.2
CheckNoDuplicateKeysForSchema traverses an explicit typed schema, folding only known field names. Unknown case-distinct metadata keys remain independent; exact duplicate keys are still rejected at every depth. Custom unmarshalers remain opaque: callers must supply a method-free schema to inspect their fields.
func ObjectFields ¶
ObjectFields returns the fields encoding/json decodes an object into, keyed by their folded JSON name.
func ValidateUnicode ¶ added in v0.67.0
ValidateUnicode refuses malformed UTF-8 and escaped unpaired surrogates. encoding/json otherwise silently substitutes the Unicode replacement character.
Types ¶
This section is empty.