Skip to content

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

David-Kunz
Copy link
Contributor

@David-Kunz David-Kunz commented May 5, 2025

  • rm @readonly and @insertonly from Access Control Annotations
  • rm @Common.FieldControl from Input Validation
  • rm @assert.notNull from Input Validation
  • mv @assert.unique to Database Constraints
  • add link to database constraints in Input Validations
  • document not null in Database Constraints
  • document not null (in actions/functions)

@David-Kunz David-Kunz requested a review from renejeglinsky as a code owner May 5, 2025 10:12
@David-Kunz David-Kunz requested review from agoerler and danjoa May 5, 2025 10:14
Copy link
Contributor

@agoerler agoerler left a 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;
}
```

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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?

Copy link
Contributor

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 };

Copy link
Contributor

@danjoa danjoa left a 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>
@danjoa
Copy link
Contributor

danjoa commented May 13, 2025

@renejeglinsky ready to merge

Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>
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.

5 participants