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

[IMPROVEMENT] Remove .drafts Property From Entities That Are Not Actually Draftable #68

Open
3 tasks
daogrady opened this issue Sep 5, 2023 · 1 comment · May be fixed by #348
Open
3 tasks

[IMPROVEMENT] Remove .drafts Property From Entities That Are Not Actually Draftable #68

daogrady opened this issue Sep 5, 2023 · 1 comment · May be fixed by #348
Labels
bug Something isn't working keepalive Will not be closed by Stale bot

Comments

@daogrady
Copy link
Contributor

daogrady commented Sep 5, 2023

Follow-up to: #34

.drafts should only be present in entities that can actually be draftable. Currently, entities that aren't actually draftable might end up with a .drafts property.

  • check with the compiler team whether there is a surefire way to determine an entity's draftability
  • if possible, get rid of the current voodoo where we propagate annotations through the CSN
  • make sure a static .drafts property is only exposed when the entity can actually be drafted during runtime
@daogrady daogrady added bug Something isn't working new keepalive Will not be closed by Stale bot and removed new labels Sep 5, 2023
@stockbal
Copy link
Contributor

stockbal commented Jul 22, 2024

Hi Daniel,

there is a way to get the sql csn with cds.compile.for.sql and the inferred csn.

const inferred = await cds.linked(await cds.load(paths, { docs: true }))
const sql = cds.compile.for.sql(inferred)

This will produce something like
image

We can just take the .drafts suffixed entries, remove the suffix and voilà, we have the entities that should get the drafts property.

I implemented it in this branch of my fork.

P.S.: There is a lot more going on in that branch, so you may have to overlook a few things 😉. If you think that we can use that approach I am happy to create a specific PR for the drafts feature only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keepalive Will not be closed by Stale bot
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants