Closed rasmk closed 3 months ago
Possibly duplicate of https://github.com/cap-js/cds-typer/issues/219 ?
It looks like a duplicate and the fix proposed in #213 seems to help. Thanks @daogrady
Hi Rafal,
that's good news then! I will make sure to merge the contributor's PR and send out a release today.
Best, Daniel
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
We have two files:
test1.cds
test2.cds
Running
npx @cap-js/cds-typer db/test2.cds --outputDirectory @cds-models
generates type for ParentAspect with a nullable ID.Expected Behavior
ID
in theParentAspect
should never be null as it is a key and is marked as not null in the CDS definition.Steps To Reproduce
Create two files: test1.cds and test2.cds, as decribed in current behavior. Run
npx @cap-js/cds-typer db/test2.cds --outputDirectory @cds-models
.Environment
Repository Containing a Minimal Reproducible Example
No response
Anything else?
The behavior is correct, if everything is defined in a single cds file. Then the generated
ID
is non-nullable.Provided the files test1.cds and test2.cds, as described above, the commands:
npx @cap-js/cds-typer db/test2.cds --outputDirectory @cds-models
- provides incorrect resultnpx @cap-js/cds-typer db/test2.cds db/test1.cds --outputDirectory @cds-models
- provides incorrect resultnpx @cap-js/cds-typer db/test1.cds db/test2.cds --outputDirectory @cds-models
- provides correct result