-
Notifications
You must be signed in to change notification settings - Fork 742
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
Generate enums even with 1 value #783
Comments
@stankovski @emgerner-msft, @brjohnstmsft , @NiklasGustafsson, @markcowl When should this happen?
|
In addition, allowed values are rendered in the documentation comments for the property or parameter to provide some help to the user. |
closing this as the PR is merged. |
@amarzavery Why can't this "enum-as-constant" behavior be opt-in? If I put /// <summary>
/// Initializes a new instance of the Suggester class.
/// </summary>
public Suggester(string name, string searchMode, IList<string> sourceFields)
{
Name = name;
SearchMode = searchMode;
SourceFields = sourceFields;
}
/// <summary>
/// Gets or sets the name of the suggester.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating the capabilities of the suggester.
/// </summary>
[JsonProperty(PropertyName = "searchMode")]
public string SearchMode { get; set; }
Yes, it does matter, because you're creating more work for customers to upgrade to the newer library. I freely admit that it's lame having a single-valued enum, and it was premature generalization on our part when we designed the API. That said, we have shipped that API and a .NET client that models Please be careful when making such changes to AutoRest. They really need to be opt-in. |
The problem with the enum type being modeled as a string was actually a bug that was fixed after 0.15.0, but my original point about being able to opt out of the "enum-as-constant" behavior remains. |
6196ce0 Merge pull request Azure#20 from jianghaolu/master 06f30cf Checkstyle passes everywhere 2bf6b8b Merge pull request Azure#783 from jianghaolu/javadocs b14cc72 Merge pull request Azure#779 from jianghaolu/paramhostfix 546e068 Network passes checkstyle 14b071c Merge commit '4aa3dd4b847e747387475e9249c4aba97b6ef8ac' into paramhostfix 1ae4191 Merge pull request Azure#19 from jianghaolu/updates 8b43962 Remove header after use 3e644d9 Fix parameterized host concurrency issue 95fa032 Done storage usages 7ad2207 Update dependencies to official releases git-subtree-dir: ClientRuntimes/Java git-subtree-split: 6196ce04c6741ceefc26f23f96c9e80a1dd78249
Currently
x-ms-enum
tagged enums are generated as strings in C#The text was updated successfully, but these errors were encountered: