-
Notifications
You must be signed in to change notification settings - Fork 41
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
[TCGC][Bug] getAllModels, Optional literal do not have correct generated name #553
Comments
i think this is something we can add. The root of the difference is java and .net want constants returned as single-value enums, while js and python will keep it as a single value constant. We should have an input to tcgc that allows you to toggle this behavior. If an enum is returned in this case, we will automatically return a generated name |
Hey @iscai-msft , thanks for the confirmation, for Java, it is fixed enum. |
@pshao25 could you help confirm .net behavior? |
We are extensible enum currently, but it is very subject to change. So we don't have any request for TCGC for now. |
@haolingdong-msft i want to confirm java do this for all the constants or just model properties? |
This is for all optional literal cases. Is there any difference between generating name for model property and for all cases from TCGC side? |
the difference is right now, the It makes sense to add this behavior in tcgc though, where we add For now, I would say this isn't a blocker for tcgc adoption. You can keep your current code that comes up with a name for these constants (worst case you need to look into |
fixes #553 --------- Co-authored-by: iscai-msft <[email protected]>
fixes #553 --------- Co-authored-by: iscai-msft <[email protected]>
TSP definition:
Java code:
In Java's generated code, we will generate an enum for the
optionalLiteral
, the enum is calledModelOptionalLiteral
, like below. I guess this optional literal is like anonymous model, and will need TCGC to generate a correct name for it.Discussed with @tadelesh offline, TCGC does not handle the name for it currently. It is better if TCGC can handle it.
@archerzz @pshao25 Does
.Net
have this behavior? What will .Net generate for optional literal?The text was updated successfully, but these errors were encountered: