Describe the bug
The following file is generated:
generated@typespec\http-server-csharp\generated\models\createdByType.cs
with the following contents:
// Generated by @typespec/http-server-csharp
// <auto-generated />
#nullable enable
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.Throttling;
[JsonConverter(typeof(JsonStringEnumConverter))]
/// <summary>
/// The kind of entity that created the resource.
/// </summary>
public enum CreatedByType
{
/// <summary>
/// The entity was created by a user.
/// </summary>
[JsonStringEnumMemberName("User")]
User,
/// <summary>
/// The entity was created by an application.
/// </summary>
[JsonStringEnumMemberName("Application")]
Application,
/// <summary>
/// The entity was created by a managed identity.
/// </summary>
[JsonStringEnumMemberName("ManagedIdentity")]
ManagedIdentity,
/// <summary>
/// The entity was created by a key.
/// </summary>
[JsonStringEnumMemberName("Key")]
Key
}
Note a few issues:
- camel casing of the file: createdByType.cs
- The XML doc is below attribute
[JsonConverter]
- Unused usings:
using System.Text.Json; (minor; might be needed by other generated files)
- Unncessary attrubyte
[JsonStringEnumMemberName] (since the enum member exactly matches the name being passed; but again - minor and might be needed by other generated files)
Reproduction
emit:
- "@typespec/http-server-csharp"
options:
"@typespec/http-server-csharp":
emitter-output-dir: "{project-root}/generated/{emitter-name}"
output-type: all
Checklist
Describe the bug
The following file is generated:
with the following contents:
Note a few issues:
[JsonConverter]using System.Text.Json;(minor; might be needed by other generated files)[JsonStringEnumMemberName](since the enum member exactly matches the name being passed; but again - minor and might be needed by other generated files)Reproduction
emit:
options:
"@typespec/http-server-csharp":
emitter-output-dir: "{project-root}/generated/{emitter-name}"
output-type: all
Checklist