projectBootstrapCollection converts a models.Collection into the slim bootstrap projection. The `schema` field is emitted as a nested JSON object when the stored string is valid JSON; an empty or malformed schema is omitted (omitempty + nil RawMessage) so the response never carries garbage that woul
(c models.Collection)
| 105 | // that match the auto-fill rule carry no information the agent can't |
| 106 | // reconstruct). |
| 107 | func projectBootstrapCollection(c models.Collection) BootstrapCollection { |
| 108 | out := BootstrapCollection{ |
| 109 | Slug: c.Slug, |
| 110 | Name: c.Name, |
| 111 | Prefix: c.Prefix, |
| 112 | Icon: c.Icon, |
| 113 | Description: c.Description, |
| 114 | SortOrder: c.SortOrder, |
| 115 | IsDefault: c.IsDefault, |
| 116 | IsSystem: c.IsSystem, |
| 117 | ItemCount: c.ItemCount, |
| 118 | ActiveItemCount: c.ActiveItemCount, |
| 119 | } |
| 120 | if s := strings.TrimSpace(c.Schema); s != "" && json.Valid([]byte(s)) { |
| 121 | out.Schema = trimRedundantSchemaLabels([]byte(s)) |
| 122 | } |
| 123 | return out |
| 124 | } |
| 125 | |
| 126 | // bootstrapSchema is the bootstrap-side schema shape, parallel to |
| 127 | // models.CollectionSchema. Used only by trimRedundantSchemaLabels to |
no test coverage detected