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
I want to open that feature request to recap some features\PR I see in the project.
I would understand the behavior with required and nullable options and nullable value types in the models codegen.
Moving from Swagger I have a breaking change I want to understand.
In Swagger we have that all the value type fields of a model are nullable, here not.
I see in the migration guideline a few informations about nullables.
public class Pet
{
public long? Id {get; set; }
public string Name {get; set; }
public long? Age {get; set; }
public string Owner {get; set; }
}
In this version everything is nullable to better specify a default value when data is missing in serialization\deserialization. It's useful, but having required, validated fields managed always as nullable is not so much good.
Here the OpenApi version:
public class Pet
{
public long Id {get; set; }
public string Name {get; set; }
public long Age {get; set; }
public string Owner {get; set; }
}
In this version it's difficult to manage not required fields, when the default value is available or not? You cannot know it.
Here my expected version:
public class Pet
{
public long Id {get; set; }
public string Name {get; set; }
public long? Age {get; set; }
public string Owner {get; set; }
}
Here the not required value type Age is proposed as nullable, the required Id not.
Must I change the specification generating supporting definitions such x-nullable?
I understand the difference between required and nullable, they have different meanings, but in C# an optional value type seems right to be managed as nullable.
My issue was to have a NetFramework WebApi project with Swagger, and the OpenApi client generator reading the server documentation, missing of x-nullable informations.
So I added server side a Swagger SchemaFilter to produce for not required value types the missing informations.
I want to open that feature request to recap some features\PR I see in the project.
I would understand the behavior with required and nullable options and nullable value types in the models codegen.
Moving from Swagger I have a breaking change I want to understand.
In Swagger we have that all the value type fields of a model are nullable, here not.
I see in the migration guideline a few informations about nullables.
example
The specification:
Here the Swagger version:
In this version everything is nullable to better specify a default value when data is missing in serialization\deserialization. It's useful, but having required, validated fields managed always as nullable is not so much good.
Here the OpenApi version:
In this version it's difficult to manage not required fields, when the default value is available or not? You cannot know it.
Here my expected version:
Here the not required value type Age is proposed as nullable, the required Id not.
Must I change the specification generating supporting definitions such x-nullable?
I understand the difference between required and nullable, they have different meanings, but in C# an optional value type seems right to be managed as nullable.
Here past issues involved:
Here open issues involved:
Thank you all.
People involved: @Blackclaws @devhl-labs @DavidJeppesen-Seges
The text was updated successfully, but these errors were encountered: