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

Function addObjectExamples

pkg/parser/schema_suggestions.go:442–456  ·  view source on GitHub ↗
(result map[string]any, properties map[string]any, requiredFields map[string]struct {
}, includeRequired bool, count int)

Source from the content-addressed store, hash-verified

440}
441
442func addObjectExamples(result map[string]any, properties map[string]any, requiredFields map[string]struct {
443}, includeRequired bool, count int) int {
444 for propName, propSchema := range properties {
445 if setutil.Contains(requiredFields, propName) != includeRequired || count >= maxExampleFields {
446 continue
447 }
448 propSchemaMap, ok := propSchema.(map[string]any)
449 if !ok {
450 continue
451 }
452 result[propName] = generateExampleFromSchema(propSchemaMap)
453 count++
454 }
455 return count
456}
457
458// enumValuePattern matches single-quoted values in enum error messages like "value must be one of 'a', 'b', 'c'"
459var enumValuePattern = regexp.MustCompile(`'([^']+)'`)

Callers 1

generateObjectExampleFunction · 0.85

Calls 2

ContainsFunction · 0.92

Tested by

no test coverage detected