MCPcopy Create free account
hub / github.com/github/gh-aw / marshalImportInputValue

Function marshalImportInputValue

pkg/workflow/expression_extraction.go:521–530  ·  view source on GitHub ↗

marshalImportInputValue serializes an import input value to a string suitable for substitution into both YAML frontmatter and markdown prose. Arrays and maps are serialized as JSON (which is valid YAML inline syntax). Scalar values use Go's default string formatting. goccy/go-yaml may produce typed

(value any)

Source from the content-addressed store, hash-verified

519// goccy/go-yaml may produce typed slices (e.g. []string) instead of []any, so
520// a reflection fallback converts any slice kind to []any before JSON marshaling.
521func marshalImportInputValue(value any) string {
522 if formatted, ok := importinpututil.FormatResolvedValue(value); ok {
523 return formatted
524 }
525 if value == nil {
526 // Null import input — return empty string rather than panicking.
527 return ""
528 }
529 return fmt.Sprintf("%v", value)
530}
531
532// resolveImportInputPath resolves a potentially dotted key path from the importInputs map.
533// For scalar inputs ("count"), it looks up importInputs["count"] directly.

Callers 2

SubstituteImportInputsFunction · 0.85

Calls 1

FormatResolvedValueFunction · 0.92

Tested by 1