Help us shape the future of Go! Take the 2026 Go Developer Survey

respfmt

package
v0.263.0 Latest Latest
Warning

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

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

Documentation

Overview

Package respfmt renders a JSON response body through an optional JMESPath projection and one of five output formats: yaml (default),

Index

Constants

View Source
const (
	OutputYAML       = "yaml"
	OutputYAMLStream = "yaml-stream"
	OutputJSON       = "json"
	OutputText       = "text"
	OutputTable      = "table"
)

Output names mirror the aws CLI vocabulary verbatim.

Variables

This section is empty.

Functions

func Eval

func Eval(data any, expr string, vars map[string]any) (any, error)

Eval evaluates expr against decoded data, with vars injected as native `$name` variables (keys are bare names; Eval adds the `$`). See specverb-actions.md.

func EvalBool

func EvalBool(data any, expr string, vars map[string]any) (bool, error)

EvalBool evaluates expr and reports its JMESPath truthiness, the predicate form `until` and `fail-when` need. A non-boolean result is reduced via Truthy.

func Render

func Render(raw []byte, query, output string) ([]byte, error)

Render applies the optional JMESPath projection to raw and formats the result per output. Empty raw returns empty bytes, no error. Empty query

func Truthy

func Truthy(v any) bool

Truthy reports JMESPath truthiness: null, false, "", [], and {} are false; everything else (including the number 0) is true, per the JMESPath spec.

func Validate

func Validate(expr string) error

Validate reports whether expr parses as JMESPath, without evaluating it: the build-time check that fails closed on a malformed `until`/`fail-when`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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