unmarshal

package
v1.103.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromRaw added in v0.115.0

func FromRaw(body []byte, format RawFormat, out proto.Message, doValidate bool) error

func LoadJSONBytes

func LoadJSONBytes(rawData []byte, extension string) ([]byte, error)

LoadJSONBytes Extracts raw data in JSON format from different sources, i.e yaml or json files

Types

type RawFormat

type RawFormat string
const (
	RawFormatJSON RawFormat = "json"
	RawFormatYAML RawFormat = "yaml"
	// RawFormatCUE is retained only so contracts already stored with this format
	// (and the wire enum) remain valid. CUE is no longer accepted or evaluated:
	// evaluating attacker-supplied CUE server-side is an unbounded, uncancellable
	// operation and was a DoS vector. New contracts must be JSON or YAML.
	RawFormatCUE RawFormat = "cue"
)

func IdentifyFormat

func IdentifyFormat(raw []byte) (RawFormat, error)

IdentifyFormat does best effort to identify the format of the raw contract by going the unmarshalling path in the following order: json, yaml. NOTE that we are just validating the format, not the content using regular marshalling not even proto marshalling, that comes later once we know the format. CUE is intentionally not detected: it is no longer a supported contract format.

func (RawFormat) Values

func (RawFormat) Values() (kinds []string)

Implements https://pkg.go.dev/entgo.io/ent/schema/field#EnumValues

Jump to

Keyboard shortcuts

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