Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c# code generated for "enum" does not work #2429

Closed
saharj opened this issue Mar 22, 2016 · 4 comments
Closed

c# code generated for "enum" does not work #2429

saharj opened this issue Mar 22, 2016 · 4 comments

Comments

@saharj
Copy link

saharj commented Mar 22, 2016

From @edarn on March 22, 2016 9:36

It appears to me that the client side c# code generated for enums is not correct for enums. I don´t find any enum at all. However, it looks ok for Java.

SalesItemBrief:
type: object
properties:
ItemId:
type: string
ItemType:
$ref: "#/definitions/ItemTypeEnum"

ItemTypeEnum:
type: string
enum:
- ART
- SPR
- GPR

Generated c# code:

namespace IO.Swagger.Model {

///

///
///

[DataContract]
public class ItemTypeEnum {

/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()  {
  var sb = new StringBuilder();
  sb.Append("class ItemTypeEnum {\n");

  sb.Append("}\n");
  return sb.ToString();
}

/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
  return JsonConvert.SerializeObject(this, Formatting.Indented);
}

}

Copied from original issue: swagger-api/swagger-editor#848

@wing328
Copy link
Contributor

wing328 commented Mar 22, 2016

@edarn the latest master of swagger-codegen should have enum support for C#. Please pull the latest and give it a try.

@willerup
Copy link

I think this is a duplicate of #2450.

@wing328
Copy link
Contributor

wing328 commented Apr 7, 2016

@edarn @willerup can you please give #2508 a try to see if it addresses the issue for your case?

@wing328 wing328 modified the milestones: v2.2.0, v2.1.6 Apr 14, 2016
@wing328
Copy link
Contributor

wing328 commented May 3, 2016

#2508 merged into master. Closing this one.

Please reply back if the latest master is not working for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants