MCPcopy Create free account
hub / github.com/github/gh-aw / validateRepoConfigJSON

Function validateRepoConfigJSON

pkg/workflow/repo_config.go:253–272  ·  view source on GitHub ↗

validateRepoConfigJSON validates raw JSON bytes against the repo config schema.

(data []byte, filePath string)

Source from the content-addressed store, hash-verified

251
252// validateRepoConfigJSON validates raw JSON bytes against the repo config schema.
253func validateRepoConfigJSON(data []byte, filePath string) error {
254 repoConfigLog.Printf("Validating repo config JSON schema: %s (%d bytes)", filePath, len(data))
255 schema, err := parser.GetCompiledRepoConfigSchema()
256 if err != nil {
257 return fmt.Errorf("failed to compile repo config schema: %w", err)
258 }
259
260 var doc any
261 if err := json.Unmarshal(data, &doc); err != nil {
262 return fmt.Errorf("failed to parse %s as JSON: %w", filePath, err)
263 }
264
265 if err := schema.Validate(doc); err != nil {
266 repoConfigLog.Printf("Repo config schema validation failed: %v", err)
267 return fmt.Errorf("invalid %s: %w", RepoConfigFileName, err)
268 }
269
270 repoConfigLog.Print("Repo config JSON schema validation passed")
271 return nil
272}
273
274func validateRepoConfigValues(cfg *RepoConfig) error {
275 if cfg == nil {

Callers 1

LoadRepoConfigFunction · 0.85

Calls 5

PrintMethod · 0.80
PrintfMethod · 0.45
ErrorfMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected