MCPcopy Index your code
hub / github.com/github/gh-aw / applyRelaxedIncludedFrontmatterValidation

Function applyRelaxedIncludedFrontmatterValidation

pkg/parser/include_processor.go:233–251  ·  view source on GitHub ↗
(filePath string, frontmatter map[string]any, isAgentFile bool)

Source from the content-addressed store, hash-verified

231}
232
233func applyRelaxedIncludedFrontmatterValidation(filePath string, frontmatter map[string]any, isAgentFile bool) {
234 if len(frontmatter) == 0 {
235 return
236 }
237 unexpectedFields := collectUnexpectedIncludedFrontmatterFields(frontmatter)
238 if len(unexpectedFields) > 0 {
239 fmt.Fprintf(os.Stderr, "%s\n", console.FormatWarningMessage(
240 fmt.Sprintf("Ignoring unexpected frontmatter fields in %s: %s",
241 filePath, strings.Join(unexpectedFields, ", "))))
242 }
243
244 filteredFrontmatter := filterIncludedFrontmatterForRelaxedValidation(frontmatter, isAgentFile)
245 if len(filteredFrontmatter) > 0 {
246 if err := ValidateIncludedFileFrontmatterWithSchemaAndLocation(filteredFrontmatter, filePath); err != nil {
247 fmt.Fprintf(os.Stderr, "%s\n", console.FormatWarningMessage(
248 fmt.Sprintf("Invalid configuration in %s: %v", filePath, err)))
249 }
250 }
251}
252
253func collectUnexpectedIncludedFrontmatterFields(frontmatter map[string]any) []string {
254 validFields := map[string]struct {

Tested by

no test coverage detected