(raw json.RawMessage)
| 519 | } |
| 520 | |
| 521 | func decodeCapabilityEnvelopeBody(raw json.RawMessage) (Body, error) { |
| 522 | object, err := validateJSONObject("body", raw) |
| 523 | if err != nil { |
| 524 | return nil, err |
| 525 | } |
| 526 | if _, ok := object["capability"]; !ok { |
| 527 | return nil, fmt.Errorf( |
| 528 | "%w: capability body must wrap artifact fields inside \"capability\", e.g. {\"capability\":{...}}", |
| 529 | ErrInvalidBody, |
| 530 | ) |
| 531 | } |
| 532 | return decodeNormalizedBody(raw, "capability", normalizeAndValidateCapabilityBody) |
| 533 | } |
| 534 | |
| 535 | func decodeNormalizedBody[T Body](raw json.RawMessage, label string, normalize func(*T) error) (Body, error) { |
| 536 | var body T |
nothing calls this directly
no test coverage detected