-
Notifications
You must be signed in to change notification settings - Fork 139
cds 9: modified input validations #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
agoerler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid that we have not sufficiently discussed the meaning of not null for calculated/computed elements.
| title: String not null; | ||
| } | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention that key elements are implicitly not null?
If an element is defined in a view as not null this is not enforced by the DB, I think. Same applies to calculated elements on write.
Moreover not null is a guarantee that the element is never null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an element is defined in a view as not null
How does one achieve this? Is that even possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and have the impression that it's not possible.
But then, the question arises: How do I express that a virtual/calculated/@CoreComputed element is guaranteed to not be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have double-checked with @stewsk - you can actually define a virtual element, which is not null:
type NotNullableString : String not null;
view V as select from E { *, 'x' as nns : NotNullableString };this is not possible, however:
view V as select from E { *, 'x' as nns : String not null };Co-authored-by: Adrian Görler <adrian.goerler@sap.com>
danjoa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- did some more cleanup in e66a912
- see the check marks in the top comment
- Fine for me with that.
Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>
|
@renejeglinsky ready to merge |
Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>
@readonlyand@insertonlyfrom Access Control Annotations@Common.FieldControlfrom Input Validation@assert.notNullfrom Input Validation@assert.uniqueto Database Constraintsnot nullin Database Constraintsnot null(in actions/functions)