Open D027152 opened 4 months ago
Possibly related issues: #139 #144
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.
Hey, just checked and if I upgrade from version 0.25.0 to any newer version ( 0.26.0 or 0.27.0 ) I have this duplicate identifier issue. The issue is easily reproducible by having a service and an entity in the service with the same name as the service. As I know changing the name would normally fix the issue we have no control over the names of either the service or the entity so we need to find an alternate way of fixing this.
Would be awesome if a workaround/config we could do would exist or better yet a planned fix :P
Thanks for the help and keep up the good work!
Hi @georgianjalba ,
thanks for investigating the root cause of this issue. In that case you should be able to circumvent the collision by specifying a custom singular and plural name (not: changing the actual name) for the offending entity:
service X {
@singular: 'XEntity'
@plural: 'XEntities'
entity X {}
}
Let me know if that helps.
Best, Daniel
Hi @georgianjalba @daogrady
The problem I described above is not related to the situation that @georgianjalba describes, as far as I can see. However, I just recognised that with cds-typer 0.27.0 this problem does no longer occur (I created this issue based on 0.23.0).
I also face a similar issue as @georgianjalba describes: two entities in the same service, both having an association to an entity called "ActivationStatusCodes", but the first associated entity is in namespace sap.erp4sme.c4b.masterData.integrations, the second is in namespace sap.erp4sme.c4b.masterData.businessPartners. This gave a duplicate identifier error, which I was able to overcome by specifying different deviating custom singular and plural names ('IntegrationActivationStatusCodes' and 'BusinessPartnerActivationStatusCodes').
Hi @D027152 ,
thanks for the update on your situation! Does that mean the issue is resolved?
Best, Daniel
Hi @daogrady
I don't have an issue any longer. But I understood that the solution with the singular / plural annotations is rather a workaround than a solution. However, if this is from your point of view a final solution, then I would just expect in a documentation a note that this is what someone shall do when he/she rund into the problem of duplicate identifiers.
Best regards, Stefan
@chgeo fyi please provide minimal repro that made the introduction of named service exports necessary.
@daogrady Here is the demo project: https://github.com/chgeo/issue-named-service-exports See its readme for further details.
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
When generating files in @cds-models, one of the generated files has syntac errors. e.g.
The file is this one: https://github.tools.sap/erp4sme/crypto-for-business/blob/switch-to-cds-typer-payment-master-data/%40cds-models/sap/erp4sme/c4b/masterData/businessPartners/index.ts
Expected Behavior
Files are generated without syntax errors
Steps To Reproduce
repo https://github.tools.sap/erp4sme/crypto-for-business branch switch-to-cds-typer-payment-master-data above-mentioned files are located in https://github.tools.sap/erp4sme/crypto-for-business/tree/switch-to-cds-typer-payment-master-data/%40cds-models)
to re-generate the files run npm run cds-typer:dev
Environment
Repository Containing a Minimal Reproducible Example
https://github.tools.sap/erp4sme/crypto-for-business
Anything else?
This is a follow-up for bug https://github.com/cap-js/cds-typer/issues/278