Skip to content
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

added limitations for compositions of one #729

Merged
merged 9 commits into from
Mar 12, 2024
Merged

Conversation

etimr
Copy link
Contributor

@etimr etimr commented Mar 7, 2024

required in an external ticket

@etimr etimr requested a review from David-Kunz March 7, 2024 16:25
cds/cdl.md Outdated Show resolved Hide resolved
cds/cdl.md Outdated Show resolved Hide resolved
Copy link
Contributor

@nkaputnik nkaputnik left a comment

Choose a reason for hiding this comment

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

I would approve this from my side, but as a remark: I would go even further as to completely discourage the use of composition of one outside of legacy porting, meaning that if you don't have an existing DB model to map to, then this construct shouldn't be used at all. The existing formulation is a lot more friendly, ut also catches the gist of it

cds/cdl.md Outdated Show resolved Hide resolved
@etimr etimr enabled auto-merge (squash) March 11, 2024 07:48
@etimr
Copy link
Contributor Author

etimr commented Mar 11, 2024

@renejeglinsky , @smahati could you please take a look?

cds/cdl.md Outdated
Comment on lines 694 to 696
Using of compositions of one is discouraged. There is often no added value of using them as the information can be placed in the root entity. Compositions of one have limitations as follow:
- Very limited Draft support. Fiori elements does not support compositions of one unless you take care of their creation in a custom handler.
- No extensive support for modifications over paths if compostions of one are involved. You must fill in foreign keys manually in a custom handler.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this depends very much on wether we are talking about a composition of one entity or a composition of one aspect.

The may in difference is that for a composition of one entity the foreign key is on the parent side where as for a composition of one entity the foreign key is on the target side. This makes compositions of one aspect more friendly wrt. modifications over paths.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a runtime expert, but my assumption is that the restrictions mentioned here only apply to "composition of one entity" - correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback Adrian @agoerler, I've added the word entity to make limitations more clear.
Steffen @stewsk, you are right, I'm writing about entities here.

@agoerler
Copy link
Contributor

Here I find composition of one aspect explicitly mentioned: https://cap.cloud.sap/docs/cds/cdl#default-target-cardinality

@etimr etimr merged commit 6490feb into main Mar 12, 2024
4 checks passed
@etimr etimr deleted the composition-of-one-limitations branch March 12, 2024 09:28
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.

7 participants