Ask a Question

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

SOLVED
gvilleda
New Contributor

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

 
 
2 REPLIES 2
chichepo
Champion Level 3

Hi @gvilleda 

I defined some few properties with various definitions:

chichepo_0-1674502071135.png

Then I have generated an aspnetcore server stub:

chichepo_1-1674502385587.png

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?

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!

cancel
Showing results for 
Search instead for 
Did you mean: