Dear Team,
Can anyone help me here? Thanks in advance if some one free me from this
obstacle.
On Friday, 16 March 2018 21:00:18 UTC+5:30, Mahesh Kumar K wrote:
>
> 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.
>
>
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.