Forum Discussion

gvilleda's avatar
gvilleda
New Contributor
2 years ago

swaggerhub codegen aspnetcore pattern/minLength/maxLength not included in the generated code.

When generating the server code from SwaggerHub, some features are not available on the generated aspnetcore code. For example, I can add a pattern or minLength property and the spring generated code will properly include the required validation (e.g. Pattern(regexp="^[a-zA-Z0-9_]*$") Size(min=3,max=30))

However, the generated aspnetcore does not have any of those properties. 

Is this an expected behavior, a configuration that is missing or something like that. 

Thanks

 
 
  • Hi gvilleda 

    I defined some few properties with various definitions:

    Then I have generated an aspnetcore server stub:

    As you can see, the properties and their definitions are properly restitued in the Server code.
    I remember I had similar issues when I was using an old CodeGen version.
    My current version is 3.0.36.
    Which version are you using?

  • chichepo's avatar
    chichepo
    Champion Level 2

    Hi gvilleda 

    I defined some few properties with various definitions:

    Then I have generated an aspnetcore server stub:

    As you can see, the properties and their definitions are properly restitued in the Server code.
    I remember I had similar issues when I was using an old CodeGen version.
    My current version is 3.0.36.
    Which version are you using?

    • gvilleda's avatar
      gvilleda
      New Contributor

      I don't know exactly which version we are using for our on-prem SwaggerHub installation but I was told that an upgrade is coming. I tested on the new site and the properties are generated OK. 

      Thanks!