-
Notifications
You must be signed in to change notification settings - Fork 296
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
How to name certain enum values #7868
Comments
I'd prefer |
Agreed on Note that the linter will complain about |
Have an example of the linter message handy? We can always override it in those cases. |
pub enum Versions {
V2002_12_01_Preview,
}
If we're happy with the name as-is then yeah we can suppress. |
Cringe: "upper camel case". It's called PascalCase! Yeah, I prefer the look of the underscores, and it jives with some of our other languages as well. I think just slap the |
Actually, why are we generating an enum for versions at all? Per guideline discussions (and written guidelines), we always target the latest version but do allow the customers to pass in an |
I added guidelines, but we should answer my question above before merging. /cc @ronniegeraghty |
What if we just don't emit version enums at all? |
The enums for the applicable API versions are defined by the tsp. Here's an example from KV. What I'm reading is that we want to skip emitting these and just emit a |
Correct. Ignore the enum in the TypeSpec and use somehow set the default api-version value for clients to the version that is being used to generate the code. There must be some way to tell the code generator what api-version to generate code for, right? |
Yes, we know the default value to use. I will make this change in the codegen today. |
Per the guidelines - in which I figured we wouldn't have generated versions, mimicking Go and C++ - set the default in the pub struct ExampleClientOptions {
api_version: String,
client_options: azure_core::ClientOptions,
}
impl Default for ExampleClientOptions {
fn default() -> Self {
api_version: String::from("7.5"),
client_options: Default::default(),
}
} |
Example names of enum values we get from TCGC.
V7.6_preview.1
V2022_12_01_preview
Propose we name them as follows.
V7Dot6_Preview
V2022_12_01Preview
The
.
character isn't legal in a name (syntax error), so must be removed.For patterns like
01_preview
the linter complains that it should be01Preview
.The text was updated successfully, but these errors were encountered: