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

Function validateAWFConfigJSON

pkg/workflow/awf_config.go:109–123  ·  view source on GitHub ↗

validateAWFConfigJSON validates the provided AWF config JSON string against the embedded AWF config schema. Returns nil if validation passes.

(configJSON string)

Source from the content-addressed store, hash-verified

107// validateAWFConfigJSON validates the provided AWF config JSON string against the
108// embedded AWF config schema. Returns nil if validation passes.
109func validateAWFConfigJSON(configJSON string) error {
110 schema, err := getCompiledAWFConfigSchema()
111 if err != nil {
112 return err
113 }
114 var doc any
115 if err := json.Unmarshal([]byte(configJSON), &doc); err != nil {
116 return fmt.Errorf("failed to parse AWF config JSON: %w", err)
117 }
118 normalizeTemplatableModelFallbackEnabled(doc)
119 if err := schema.Validate(doc); err != nil {
120 return fmt.Errorf("AWF config schema validation failed: %w", err)
121 }
122 return nil
123}
124
125// normalizeTemplatableModelFallbackEnabled adjusts a generated AWF config document
126// for compile-time schema validation by coercing modelFallback.enabled GitHub Actions

Calls 4

ErrorfMethod · 0.45
ValidateMethod · 0.45