Open chuckberrry opened 1 month ago
Hi Armin,
thanks for this report and for providing a minimal model!
I was not able to reproduce the issue with the model you provided. Do you maybe have another entity called SalesDelivery
which falls into the same namespace?
Could you also please point out why you are explicitly setting the singular for this entity, given that it is the same as its regular name?
Best, Daniel
Hi Daniel,
No, there is no other entity called SalesDelivery. You can also use the tiny cap example and change the entity "Books" as follows:
@singular: 'Book'
@plural : 'Books'
entity Book : managed {
key ID : Integer;
title : localized String(111) @mandatory;
descr : localized String(1111);
stock : Integer;
}
We are in the process of introducing cds-typer into existing CAP projects where the naming convention for entities is singular. Simply setting the @plural annotation to entity "Book" does not seem to be enough, because I get the same error message that the singular could not be derived. For this reason, I have also added the singular annotation.
best regards, Armin
Hi Armin,
this is really curious, as I can not reproduce the described behaviour with the second model either.
Could you please put this minimal model into a separate foo.cds file, then run cds-typer foo.cds
to make sure it is run in isolation. Then if the error persists, check the output of cds-typer --version
to make sure there is no old version of cds-typer at play beside the one you have in your project.
Best, Daniel
I was able to reproduce this with the following foo.cds:
namespace my.bookshop;
@singular: 'Book'
@plural : 'Books'
entity Book {
key ID : Integer;
title : localized String(111) @mandatory;
descr : localized String(1111);
stock : Integer;
}
and cds-typer version 0.21.1.
Interestingly, this error was only reproducible with a defined namespace.
best regards, Armin
Hi Armin,
thanks for putting in the work to track down the exact circumstances in which the bug occurs! I can now reproduce the issue and will look into asap.
Best, Daniel
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
When I try to enter the singular and plural names as described in the documentation, I get the error message that the derived singular already exists.
[ERROR] Derived singular 'SalesDelivery' for your entity 'my.bookshop.SalesDelivery', already exists. The resulting types will be erronous. Consider using '@singular:'/ '@plural:' annotations in your model or move the offending declarations into different namespaces to resolve this collision.
Expected Behavior
The name of the singular entity should be taken from the @singular annotation and not derived.
Steps To Reproduce
Environment
Repository Containing a Minimal Reproducible Example
No response
Anything else?
No response