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

[BUG] "excluding" clause in CDS projections not applied for compiled TS models #117

Closed
1 task done
siarhei-murkou opened this issue Nov 29, 2023 · 2 comments · Fixed by #118
Closed
1 task done
Labels
bug Something isn't working

Comments

@siarhei-murkou
Copy link
Contributor

siarhei-murkou commented Nov 29, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Nature of Your Project

TypeScript

Current Behavior

Example:

namespace sap.testmodels;

entity TestObjects {
    key ID: UUID;
    name: String not null;
    description: String;
    dependencies: Association to many ...;
    ...
}
using sap.testmodels as db from '../db';

service TestService {
    entity TestObjects as projection on db.TestObjects excluding { dependencies };
}

The CDS entities above are compiled to

class TestObjects {
    ID: string;
    name: string;
    description: string | null;
    dependencies: Association.to.many<...>;
}

Expected Behavior

Compiled TypeScript models should leave out properties which are marked as excluded on CDS layer.

class TestObjects {
    ID: string;
    name: string;
    description: string | null;
}

Steps To Reproduce

No response

Environment

- **OS**: MacOS 14.1.1
- **Node**: 18.18.2
- **npm**: 9.8.1
- **cds-typer**: 0.12.0
- **cds**: 7.3.1

Repository Containing a Minimal Reproducible Example

No response

Anything else?

Absolutely the same result if to use explicit select of certain properties. For example:

using sap.testmodels as db from '../db';

service TestService {
    entity TestObjects as projection on db.TestObjects { ID, name, description as desc };
}
@daogrady
Copy link
Contributor

daogrady commented Dec 5, 2023

Hi Siarhei,

thank you for reporting this gap! It will be fixed in #118
Feel free to check the PR out on your model before I merge it.

Best,
Daniel

@siarhei-murkou
Copy link
Contributor Author

Hi Daniel,
Thank you for fixing it quite quickly! 🙂

The fix works fine for me, so PR can be merged. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants