-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Description
Description
C# auto generated aspnetcore project contains invalid enums
Swagger-codegen version
2.3.1
Swagger declaration file content or url
Gist here
yaml code
status:
type: "string"
description: "pet status in the store"
enum:
- "available"
- "pending"
- "sold"
Command line used for generation
editor.swagger.io
Steps to reproduce
- Take code from gist
- Paste into editor.swagger.io (http, not https)
- Generate an
aspnetcoreserver - Model generated looks like the following:
public enum StatusEnum
{
/// <summary>
/// Enum AvailableEnum for available
/// </summary>
[EnumMember(Value = available)]
AvailableEnum = 1,
/// <summary>
/// Enum PendingEnum for pending
/// </summary>
[EnumMember(Value = pending)]
PendingEnum = 2,
/// <summary>
/// Enum SoldEnum for sold
/// </summary>
[EnumMember(Value = sold)]
SoldEnum = 3
}
This is invalid C#, the Value = x should be Value = "x".
Related issues/PRs
Suggest a fix/enhancement
Generated model should look like the following:
public enum StatusEnum
{
/// <summary>
/// Enum AvailableEnum for available
/// </summary>
[EnumMember(Value = "available")]
AvailableEnum = 1,
/// <summary>
/// Enum PendingEnum for pending
/// </summary>
[EnumMember(Value = "pending")]
PendingEnum = 2,
/// <summary>
/// Enum SoldEnum for sold
/// </summary>
[EnumMember(Value = "sold")]
SoldEnum = 3
}
Metadata
Metadata
Assignees
Labels
No labels