You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we look at the generated Book type, we expect to be able to access the author information with the name author. Unfortunately this is not possible as the CDS runtime is flattening the author element down to
author_firstName
author_lastName
Therefore the generated types for element author are not usable.
Expected Behavior
The generated types correctly reflect the CDS model during runtime
The fix in #346 currently works only by setting the option inlineDeclarations to flat. This would be another opportunity to revisit this CLI option, as both inline and named struct type elements result in erroneous generated types, when option structured is used.
This issue has not been updated in a while. If it is still relevant, please comment on it to keep it open. The issue will be closed soon if it remains inactive.
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
Let's assume the following sample model.
// schema.cds
// index.ts
If we look at the generated Book type, we expect to be able to access the author information with the name
author
. Unfortunately this is not possible as the CDS runtime is flattening the author element down toauthor_firstName
author_lastName
Therefore the generated types for element
author
are not usable.Expected Behavior
The generated types correctly reflect the CDS model during runtime
Steps To Reproduce
No response
Environment
Repository Containing a Minimal Reproducible Example
https://github.com/stockbal/cap-samples/tree/typer-playground?tab=readme-ov-file#named-type-definitions-as-elements-not-reflected-correctly-in-class-properties
Anything else?
I provided a fix with PR #346.
The text was updated successfully, but these errors were encountered: