MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / Validate

Method Validate

plugins/destination/bigquery/client/spec.go:142–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140}
141
142func (s *Spec) Validate() error {
143 if s.ProjectID == "" {
144 return errors.New("project_id is required")
145 }
146 if s.DatasetID == "" {
147 return errors.New("dataset_id is required")
148 }
149 if err := s.TimePartitioning.Validate(); err != nil {
150 return fmt.Errorf("time_partitioning: %w", err)
151 }
152 if s.TimePartitioning == TimePartitioningOptionNone && s.TimePartitioningExpiration.Duration() > 0 {
153 return errors.New("time_partitioning_expiration option requires time_partitioning to be set")
154 }
155 if len(s.ServiceAccountKeyJSON) > 0 {
156 if err := isValidJson(s.ServiceAccountKeyJSON); err != nil {
157 return fmt.Errorf("invalid json for service_account_key_json: %w", err)
158 }
159 }
160 if s.TextEmbeddings != nil {
161 if err := s.TextEmbeddings.Validate(); err != nil {
162 return fmt.Errorf("text_embeddings: %w", err)
163 }
164 }
165 return nil
166}
167
168func isValidJson(content string) error {
169 var v map[string]any

Callers 4

TestConnectionFunction · 0.95
NewFunction · 0.45

Calls 2

ErrorfMethod · 0.80
isValidJsonFunction · 0.70

Tested by 3

TestConnectionFunction · 0.76