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

Function getCompiledAWFConfigSchema

pkg/workflow/awf_config.go:95–105  ·  view source on GitHub ↗

getCompiledAWFConfigSchema returns the compiled AWF config schema, compiling once and caching.

()

Source from the content-addressed store, hash-verified

93
94// getCompiledAWFConfigSchema returns the compiled AWF config schema, compiling once and caching.
95func getCompiledAWFConfigSchema() (*jsonschema.Schema, error) {
96 compiledAWFConfigSchemaOnce.Do(func() {
97 awfConfigLog.Print("Compiling AWF config schema (first time)")
98 schemaURL := fmt.Sprintf("https://github.com/github/gh-aw-firewall/releases/download/%s/awf-config.schema.json", constants.DefaultFirewallVersion)
99 compiledAWFConfigSchema, awfConfigSchemaCompileError = compileSchema(awfConfigSchema, schemaURL)
100 if awfConfigSchemaCompileError == nil {
101 awfConfigLog.Print("AWF config schema compiled successfully")
102 }
103 })
104 return compiledAWFConfigSchema, awfConfigSchemaCompileError
105}
106
107// validateAWFConfigJSON validates the provided AWF config JSON string against the
108// embedded AWF config schema. Returns nil if validation passes.

Callers 1

validateAWFConfigJSONFunction · 0.85

Calls 2

PrintMethod · 0.80
compileSchemaFunction · 0.70

Tested by

no test coverage detected