You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating a model with a UUID property, 'EmitDefaultValue' is set to 'false' if the field is required and not nullable. I think that in such case, it should be set to 'true'. For instance, an int property with the same configuration sets 'EmitDefaultValue' to 'true' because it is a value type. I believe that a Guid should also be considered a value type.
Describe the solution you'd like
I am wondering if it would be possible to extend the return values of the getValues function in AspNetServerCodegen.java to include "DateTime", "DateOnly", "DateTimeOffset", and "Guid". This suggestion is similar to the implementation in AbstractCSharpCodegen.java, where the code generator for C# client works as expected.
Describe alternatives you've considered
As a workaround, we have to override model.mustache by using x-csharp-value-type instead of x-is-value-type: [DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-csharp-value-type}}true{{/vendorExtensions.x-csharp-value-type}}{{^vendorExtensions.x-csharp-value-type}}false{{/vendorExtensions.x-csharp-value-type}}{{/isNullable}})], but we would like to use the standard template as much as possible.
Is your feature request related to a problem? Please describe.
Generator name: aspnetcore
Generator cli version: 7.5.0
When generating a model with a UUID property, 'EmitDefaultValue' is set to 'false' if the field is required and not nullable. I think that in such case, it should be set to 'true'. For instance, an int property with the same configuration sets 'EmitDefaultValue' to 'true' because it is a value type. I believe that a Guid should also be considered a value type.
Describe the solution you'd like
I am wondering if it would be possible to extend the return values of the getValues function in AspNetServerCodegen.java to include "DateTime", "DateOnly", "DateTimeOffset", and "Guid". This suggestion is similar to the implementation in AbstractCSharpCodegen.java, where the code generator for C# client works as expected.
Describe alternatives you've considered
As a workaround, we have to override model.mustache by using x-csharp-value-type instead of x-is-value-type:
[DataMember(Name="{{baseName}}", EmitDefaultValue={{#isNullable}}true{{/isNullable}}{{^isNullable}}{{#vendorExtensions.x-csharp-value-type}}true{{/vendorExtensions.x-csharp-value-type}}{{^vendorExtensions.x-csharp-value-type}}false{{/vendorExtensions.x-csharp-value-type}}{{/isNullable}})]
, but we would like to use the standard template as much as possible.Additional context
Script:
Schema:
Output:
The text was updated successfully, but these errors were encountered: