Add reference slot clone helper

This commit is contained in:
2026-07-06 17:06:24 +00:00
parent 7861d040df
commit 223f3751e8
2 changed files with 66 additions and 0 deletions

View File

@@ -132,6 +132,18 @@ type ReferenceSlot struct {
MaxBytes int64 `json:"max_bytes,omitempty"`
}
func CloneReferenceSlots(slots []ReferenceSlot) []ReferenceSlot {
if len(slots) == 0 {
return nil
}
out := make([]ReferenceSlot, len(slots))
for i, slot := range slots {
slot.AcceptedMediaTypes = append([]string(nil), slot.AcceptedMediaTypes...)
out[i] = slot
}
return out
}
type ReferenceOrigin struct {
Type string `json:"type"`
URI string `json:"uri,omitempty"`