Module Overview
github.com/santhosh-tekuri/jsonschema/v6 (pinned v6.0.3) is the dependency-free JSON
Schema validator (drafts 4/6/7/2019-09/2020-12) that backs every schema-driven validation
path in gh-aw: workflow frontmatter, MCP config, repo config, aw manifest, and per-tool
samples: validation for safe-outputs.
Current Usage in gh-aw
- Files: 9 non-test
.go files import it directly.
- Key call sites:
pkg/parser/schema_compiler.go — shared CompileSchema/compileSchema helper; compiles
and caches (via syncutil.OnceLoader) the 4 embedded schemas (main workflow, MCP config,
repo config, aw manifest).
pkg/parser/json_path_locator.go — converts *jsonschema.ValidationError causes into
YAML source locations for compiler-style diagnostics.
pkg/workflow/schema_validation.go — validates parsed workflow YAML, unwraps
*jsonschema.ValidationError via errors.As to add field-specific examples.
pkg/workflow/awf_config_schema.go, pkg/workflow/schema_utils.go — AWF config schema
compile/cache and a thin re-export.
pkg/workflow/samples_validation.go — compiles per-MCP-tool inputSchemas from
safe_outputs_tools.json on demand and validates samples: entries against them.
- APIs used:
NewCompiler/AddResource/Compile, Schema.Validate(any) (validates
already-decoded YAML/JSON — no marshal roundtrip), *jsonschema.ValidationError
(.Causes, .InstanceLocation, .ErrorKind), and the jsonschema/v6/kind package
(kind.AdditionalProperties, kind.OneOf/AnyOf/AllOf/Group) for structural error
inspection.
Research Findings
⚠️ Network access was unavailable this run — gh api, WebFetch, and WebSearch all
failed (no outbound network / invalid GH_TOKEN in this sandbox), so I could not confirm the
latest release, changelog, or maintainer-recommended patterns for v6.0.3 against upstream.
Filed a separate missing_tool note for this. The findings below come from static analysis
of gh-aw's own usage plus documented/known behavior of the library and the JSON Schema spec.
Already-good practice: pkg/parser/json_path_locator.go prefers the structural
ErrorKind API (e.g. reading ap.Properties off a *kind.AdditionalProperties) over
regexing the error message — this is exactly the idiomatic v6 pattern and should be the
template for any new error-parsing code in this package. Schema.Validate(any) is also used
directly on decoded YAML/JSON without a round-trip, which is the efficient path the library
is designed for.
Improvement Opportunities
🏃 Quick Wins
- Declared
format constraints are silently unenforced. pkg/parser/schemas/main_workflow_schema.json
(draft-07) declares "format": "date" for the custom-agent metadata expires field and
"format": "uri" for the docs field and two OIDC audience fields. Per JSON Schema
semantics, format is annotation-only unless the compiler explicitly enables assertion —
none of the compileSchema/CompileSchema call sites configure format assertion on the
jsonschema.Compiler. In practice, expires: not-a-date or audience: "not a uri" in
workflow frontmatter currently passes schema validation silently. Recommend either enabling
format assertion on the compiler (confirm the exact v6 API once docs are reachable) so these
4 fields are actually checked, or adding a short comment at the compile call sites noting
format is intentionally advisory-only (and verifying these fields aren't hand-validated
elsewhere, which would make the schema annotation misleading).
✨ Feature Opportunities
additionalPropertyNamesFor in json_path_locator.go only structurally destructures
*kind.AdditionalProperties directly; for composite kinds (OneOf/AnyOf/AllOf/Group)
it falls back to regexing the error message. If those composite kinds expose child causes
structurally (mirroring how ValidationError.Causes is already walked elsewhere in this
file), recursively walking them to find a nested *kind.AdditionalProperties would let the
regex fallback be dropped entirely — completing the fully-structural approach the file has
already moved most of the way toward.
📐 Best Practice Alignment
- No changes needed for schema compilation/caching: every compile site goes through the
shared helper and every compiled *Schema is cached behind a syncutil.OnceLoader, matching
the library's guidance that compiled schemas are safe for concurrent reuse.
🔧 General Improvements
- None beyond the above — usage is otherwise clean and idiomatic.
Recommendations
- Decide whether the 4
format-constrained fields (expires, docs, both audience
fields) should actually be enforced at schema-validation time; if yes, enable format
assertion on the compiler used by pkg/parser/schema_compiler.go.
- Extend
additionalPropertyNamesFor to structurally walk composite ErrorKinds instead of
falling back to regex.
- Re-run this review once network access is restored to confirm no new v6 release changes
any of the above (e.g. a new opt-in for format assertion, or additional kind helpers).
Next Steps
- Small follow-up PR to enable/clarify format assertion behavior on the 4 affected fields.
- Small follow-up PR to make
additionalPropertyNamesFor fully structural for composite kinds.
Generated by Go Fan 🐹
Module summary saved to: scratchpad/mods/jsonschema-v6.md
Generated by 🐹 Go Fan · claude · agent · 139.1 AIC · ⌖ 7.07 AIC · ⊞ 8.2K · ◷
Module Overview
github.com/santhosh-tekuri/jsonschema/v6(pinnedv6.0.3) is the dependency-free JSONSchema validator (drafts 4/6/7/2019-09/2020-12) that backs every schema-driven validation
path in gh-aw: workflow frontmatter, MCP config, repo config, aw manifest, and per-tool
samples:validation for safe-outputs.Current Usage in gh-aw
.gofiles import it directly.pkg/parser/schema_compiler.go— sharedCompileSchema/compileSchemahelper; compilesand caches (via
syncutil.OnceLoader) the 4 embedded schemas (main workflow, MCP config,repo config, aw manifest).
pkg/parser/json_path_locator.go— converts*jsonschema.ValidationErrorcauses intoYAML source locations for compiler-style diagnostics.
pkg/workflow/schema_validation.go— validates parsed workflow YAML, unwraps*jsonschema.ValidationErrorviaerrors.Asto add field-specific examples.pkg/workflow/awf_config_schema.go,pkg/workflow/schema_utils.go— AWF config schemacompile/cache and a thin re-export.
pkg/workflow/samples_validation.go— compiles per-MCP-toolinputSchemas fromsafe_outputs_tools.jsonon demand and validatessamples:entries against them.NewCompiler/AddResource/Compile,Schema.Validate(any)(validatesalready-decoded YAML/JSON — no marshal roundtrip),
*jsonschema.ValidationError(
.Causes,.InstanceLocation,.ErrorKind), and thejsonschema/v6/kindpackage(
kind.AdditionalProperties,kind.OneOf/AnyOf/AllOf/Group) for structural errorinspection.
Research Findings
gh api,WebFetch, andWebSearchallfailed (no outbound network / invalid
GH_TOKENin this sandbox), so I could not confirm thelatest release, changelog, or maintainer-recommended patterns for v6.0.3 against upstream.
Filed a separate
missing_toolnote for this. The findings below come from static analysisof gh-aw's own usage plus documented/known behavior of the library and the JSON Schema spec.
Already-good practice:
pkg/parser/json_path_locator.goprefers the structuralErrorKindAPI (e.g. readingap.Propertiesoff a*kind.AdditionalProperties) overregexing the error message — this is exactly the idiomatic v6 pattern and should be the
template for any new error-parsing code in this package.
Schema.Validate(any)is also useddirectly on decoded YAML/JSON without a round-trip, which is the efficient path the library
is designed for.
Improvement Opportunities
🏃 Quick Wins
formatconstraints are silently unenforced.pkg/parser/schemas/main_workflow_schema.json(draft-07) declares
"format": "date"for the custom-agent metadataexpiresfield and"format": "uri"for thedocsfield and two OIDCaudiencefields. Per JSON Schemasemantics,
formatis annotation-only unless the compiler explicitly enables assertion —none of the
compileSchema/CompileSchemacall sites configure format assertion on thejsonschema.Compiler. In practice,expires: not-a-dateoraudience: "not a uri"inworkflow frontmatter currently passes schema validation silently. Recommend either enabling
format assertion on the compiler (confirm the exact v6 API once docs are reachable) so these
4 fields are actually checked, or adding a short comment at the compile call sites noting
format is intentionally advisory-only (and verifying these fields aren't hand-validated
elsewhere, which would make the schema annotation misleading).
✨ Feature Opportunities
additionalPropertyNamesForinjson_path_locator.goonly structurally destructures*kind.AdditionalPropertiesdirectly; for composite kinds (OneOf/AnyOf/AllOf/Group)it falls back to regexing the error message. If those composite kinds expose child causes
structurally (mirroring how
ValidationError.Causesis already walked elsewhere in thisfile), recursively walking them to find a nested
*kind.AdditionalPropertieswould let theregex fallback be dropped entirely — completing the fully-structural approach the file has
already moved most of the way toward.
📐 Best Practice Alignment
shared helper and every compiled
*Schemais cached behind asyncutil.OnceLoader, matchingthe library's guidance that compiled schemas are safe for concurrent reuse.
🔧 General Improvements
Recommendations
format-constrained fields (expires,docs, bothaudiencefields) should actually be enforced at schema-validation time; if yes, enable format
assertion on the compiler used by
pkg/parser/schema_compiler.go.additionalPropertyNamesForto structurally walk compositeErrorKinds instead offalling back to regex.
any of the above (e.g. a new opt-in for format assertion, or additional
kindhelpers).Next Steps
additionalPropertyNamesForfully structural for composite kinds.Generated by Go Fan 🐹
Module summary saved to:
scratchpad/mods/jsonschema-v6.md