jsonvalue

package
v0.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package jsonvalue implements the shared, bounded JSON document boundary used by Action contracts and protocol envelopes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte, limits Limits) (any, error)

Decode validates data and returns maps, slices, primitives, and json.Number values without losing integer precision.

func IsLimit

func IsLimit(err error) bool

IsLimit reports whether err contains a JSON resource limit failure.

func Validate

func Validate(data []byte, limits Limits) error

Validate checks that data is one bounded UTF-8 JSON value with no duplicate object member names.

Types

type LimitError

type LimitError struct {
	Resource string
	Limit    int64
}

LimitError identifies which bounded JSON resource was exhausted.

func (*LimitError) Error

func (err *LimitError) Error() string

type Limits

type Limits struct {
	MaxBytes       int64
	MaxDepth       int
	MaxNodes       int
	MaxNumberBytes int
}

Limits bounds one complete JSON document. MaxDepth counts nested object and array containers, including the root container. MaxNodes counts every JSON value, including containers, but not object member names. MaxNumberBytes counts the source bytes in one JSON number token.

Jump to

Keyboard shortcuts

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