@@ -50,24 +50,25 @@ export const OnlineEvalConfigSchema = z
5050 } )
5151 . refine (
5252 data => {
53- const hasAgent = data . agent !== undefined ;
54- const hasCustom = data . customLogGroupName !== undefined && data . customServiceName !== undefined ;
55- return hasAgent || hasCustom ;
53+ // Custom fields must be provided together
54+ const hasLogGroup = data . customLogGroupName !== undefined ;
55+ const hasServiceName = data . customServiceName !== undefined ;
56+ return hasLogGroup === hasServiceName ;
5657 } ,
5758 {
58- message :
59- 'Either "agent" must be provided (for project agents) or both "customLogGroupName" and "customServiceName" (for external agents)' ,
59+ message : 'Both "customLogGroupName" and "customServiceName" must be provided together' ,
6060 }
6161 )
6262 . refine (
6363 data => {
64- // If one custom field is set, the other must also be set
65- const hasLogGroup = data . customLogGroupName !== undefined ;
66- const hasServiceName = data . customServiceName !== undefined ;
67- return hasLogGroup === hasServiceName ;
64+ const hasAgent = data . agent !== undefined ;
65+ const hasCustom = data . customLogGroupName !== undefined && data . customServiceName !== undefined ;
66+ // Exactly one source must be specified, not both
67+ return ( hasAgent || hasCustom ) && ! ( hasAgent && hasCustom ) ;
6868 } ,
6969 {
70- message : 'Both "customLogGroupName" and "customServiceName" must be provided together' ,
70+ message :
71+ 'Specify either "agent" (for project agents) or both "customLogGroupName" and "customServiceName" (for external agents), but not both' ,
7172 }
7273 ) ;
7374
0 commit comments