Open
Description
Background
For optional literal, Java will generate an enum for it. For example, for below case, optionalLiteral
will be generated as an enum named ModelOptionalLiteral
.
model Model {
literal: "literal";
optionalLiteral?: "optionalLiteral";
}
alias Request = {
@query
literalParam: "literalParam";
@query
optionalLiteralParam?: "optionalLiteralParam";
};
@route("/literal")
interface LiteralOp {
@put
@route("/put")
put(...Request, @body body: Model): Model;
}
Issue
But ModelOptionalLiteral
is just a constant in TCGC which has no usage. But we will generate it as enum, so we need usage. When there is no usage, we will not generate the model, so after adopting TCGC, ModelOptionalLiteral
is deleted.
Solution
TCGC provide usage and access for SdkConstantType
, so that we can get the usage and access from TCGC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment