[BUG][CSharp] Bug generating code with Enum having maxLength property
Created by: shwetashukla
Hi
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
We have an open api spec version 2.0 and we are trying to generate code in csharp . We have an issue in generated SDKif the property whose type is string is an enum and has maxLength specified . Please refer line 121 in attached contract . petstore.txt
Below is the code in csharp and the one in bold throws error.
// Status (string) maxLength if(this.Status != null && this.Status.Length > 20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Status , length must be less than 20.", new [] { "Status " }); }
openapi-generator version
3.3.4
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
csharp code should be like The code should be like this.Status.ToString().Length.
In the snapshot below we can make fix