MCPcopy Create free account
hub / github.com/compozy/agh / decodeNormalizedBody

Function decodeNormalizedBody

internal/network/validate.go:535–544  ·  view source on GitHub ↗
(raw json.RawMessage, label string, normalize func(*T) error)

Source from the content-addressed store, hash-verified

533}
534
535func decodeNormalizedBody[T Body](raw json.RawMessage, label string, normalize func(*T) error) (Body, error) {
536 var body T
537 if err := decodeJSON(raw, &body); err != nil {
538 return nil, fmt.Errorf("%w: %s body: %w", ErrInvalidBody, label, err)
539 }
540 if err := normalize(&body); err != nil {
541 return nil, err
542 }
543 return body, nil
544}
545
546func validateKindEnvelopeRules(env Envelope) error {
547 body, err := env.DecodeBody()

Callers 2

bodyDecoderForKindFunction · 0.85

Calls 2

normalizeFunction · 0.85
decodeJSONFunction · 0.70

Tested by

no test coverage detected