-
Notifications
You must be signed in to change notification settings - Fork 10
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
[BUG] A generated index.ts files has syntax errors "Duplicate Identifier ..." #288
Comments
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. 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, |
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, |
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, |
@chgeo fyi please provide minimal repro |
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 #278
The text was updated successfully, but these errors were encountered: