Hi Team,
I have a problem with defining enum in my swagger. I used the below definition last week and used 'generate server' -> aspnetcore to generate
IO.SWAGGER.MODELS.It generated the parameter'd constructor and Enum in the Model Mail.cs file. I incorporated the models in my lambda and was compiled successfully.
This was done last week and today when i tried to generate the same, was getting different enum defined and there is no parameter'd constructor in the Model .cs file.Also, when i tried to incorporate the Model, .Net throws compilation error.
definition from swagger:
Mail:
type: object
properties:
forward:
type: string
enum:
- None
- Increment
- Reset
Working Model Mail.cs:- (copied part of it)
public enum ForwardCountActionEnum
{
/// <summary>
/// Enum NoneEnum for "None"
/// </summary>
[EnumMember(Value = "None")]
NoneEnum,
/// <summary>
/// Enum IncrementEnum for "Increment"
/// </summary>
[EnumMember(Value = "Increment")]
IncrementEnum,
/// <summary>
/// Enum ResetEnum for "Reset"
/// </summary>
[EnumMember(Value = "Reset")]
ResetEnum
}
and it generated the parameter'd constructor as below:-
public Mailbox(int? Id = default(int?), string Pin = default(string), ForwardCountActionEnum? ForwardCountAction = default(ForwardCountActionEnum?))
{
this.Id = Id;
this.Pin = Pin;
this.ForwardCountAction = ForwardCountAction;
}
Newly generated model today-:
public enum ForwardCountActionEnum
{
/// <summary>
/// Enum NoneEnum for None
/// </summary>
[EnumMember(Value = None)]
NoneEnum = 1,
/// <summary>
/// Enum IncrementEnum for Increment
/// </summary>
[EnumMember(Value = Increment)]
IncrementEnum = 2,
/// <summary>
/// Enum ResetEnum for Reset
/// </summary>
[EnumMember(Value = Reset)]
ResetEnum = 3
}
There's no constructor created.
May i know what is the problem here? I did not change anything in my swagger file.