(result map[string]any, properties map[string]any, requiredFields map[string]struct {
}, includeRequired bool, count int)
| 440 | } |
| 441 | |
| 442 | func 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'" |
| 459 | var enumValuePattern = regexp.MustCompile(`'([^']+)'`) |
no test coverage detected