| 71 | } |
| 72 | |
| 73 | func (q *QueryDataContext) UnmarshalYAML(b []byte) error { |
| 74 | var raw map[string]any |
| 75 | if err := yaml.Unmarshal(b, &raw); err != nil { |
| 76 | return fmt.Errorf("failed to unmarshal context from yaml: %w", err) |
| 77 | } |
| 78 | jsonBytes, err := json.Marshal(raw) |
| 79 | if err != nil { |
| 80 | return fmt.Errorf("failed to marshal context map: %w", err) |
| 81 | } |
| 82 | q.QueryDataContext = &geminidataanalyticspb.QueryDataContext{} |
| 83 | if err := protojson.Unmarshal(jsonBytes, q.QueryDataContext); err != nil { |
| 84 | return fmt.Errorf("failed to unmarshal context to proto: %w", err) |
| 85 | } |
| 86 | return nil |
| 87 | } |
| 88 | |
| 89 | // GenerationOptions wraps geminidataanalyticspb.GenerationOptions to support YAML decoding via protojson. |
| 90 | type GenerationOptions struct { |