Add schema selection values and ownership

This commit is contained in:
2026-11-20 15:20:29 +00:00
parent e775a3c116
commit fbe3d427a2
17 changed files with 186 additions and 9 deletions

View File

@@ -22,8 +22,26 @@ func ValidateOutputContract(contract OutputContract) error {
return fmt.Errorf("invalid validation mode: %q", contract.ValidationMode)
}
if contract.ValidationMode == ValidationJSONSchema && strings.TrimSpace(contract.SchemaPath) == "" {
return errors.New("schema_path is required when validation_mode is json_schema")
if contract.ValidationMode == ValidationJSONSchema {
count := 0
if contract.Schema != nil {
count++
}
if contract.SchemaFile != nil {
if strings.TrimSpace(*contract.SchemaFile) == "" {
return errors.New("schema_file must not be blank")
}
count++
}
if contract.SchemaPath != "" {
if strings.TrimSpace(contract.SchemaPath) == "" {
return errors.New("schema_path must not be blank")
}
count++
}
if count != 1 {
return errors.New("exactly one of schema, schema_file, or schema_path is required when validation_mode is json_schema")
}
}
if contract.RepairAttempts < 0 {
return errors.New("repair_attempts must be greater than or equal to 0")