It would be really cool if AutoRest supported this pattern for model properties of type "string" that have a well-defined but open set of choices:
/// <summary>
/// Defines the data type of a field in an Azure Search index.
/// </summary>
public partial class DataType
{
/// <summary>
/// Indicates that a field contains a string.
/// </summary>
public static readonly DataType String = new DataType("Edm.String");
/// <summary>
/// Indicates that a field contains a 32-bit signed integer.
/// </summary>
public static readonly DataType Int32 = new DataType("Edm.Int32");
/// <summary>
/// Indicates that a field contains an IEEE double-precision floating point number.
/// </summary>
public static readonly DataType Double = new DataType("Edm.Double");
/// <summary>
/// Indicates that a field contains a Boolean value (true or false).
/// </summary>
public static readonly DataType Boolean = new DataType("Edm.Boolean");
// Etc...
private string _name;
private DataType(string typeName)
{
_name = typeName;
}
/// <summary>
/// Defines implicit conversion from DataType to string.
/// </summary>
/// <param name="dataType">DataType to convert.</param>
/// <returns>The name of the DataType as a string.</returns>
public static implicit operator string(DataType dataType)
{
return dataType.ToString();
}
/// <summary>
/// Returns the name of the DataType in a form that can be used in an Azure Search index definition.
/// </summary>
/// <returns>The name of the DataType as a string.</returns>
public override string ToString()
{
return _name;
}
}
It would be really cool if AutoRest supported this pattern for model properties of type "string" that have a well-defined but open set of choices: