Skip to content

Conversation

@beckermarc
Copy link
Collaborator

@beckermarc beckermarc commented Feb 2, 2026

Improve handling of @Assert on associations
Use $now as default for Date again

Customer @assert: (case
when Customer is null then 'Customer must be specified'
when Customer is null then null // handled by @mandatory

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this check as the next line when not exists Customer then Customer does not exist` would cause an issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as indicated by the comment, the null check is also handled by a @mandatory annotation. Checking null here again leads to duplicate error messages: One from the @mandatory validation and one from the @assert validation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that´s clear. But I´m wondering why we cannot simply skip the null check here. Am I correct that if we don´t have an early exit in the case statement, the when not exists Customer then Customer does not exist would also cause a second message,?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah now I understand. Yes the when not exists Customer is also true if Customer is not set (aka null).

@beckermarc beckermarc merged commit e177ccc into main Feb 2, 2026
6 of 8 checks passed
@beckermarc beckermarc deleted the 4.7 branch February 2, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants