OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[Required]
public TimeSpan StartTime { get; set; }
public TimeSpan? EndTime { get; set; }
but since I can't generate SDK with same timespan field from the swagger json I added below line to startup class
c.MapType<TimeSpan>(() => new OpenApiSchema { Type = "string", Format = "time-span", Nullable = false });
c.MapType<TimeSpan?>(() => new OpenApiSchema { Type = "string", Format = "time-span", Nullable = true });
I then pass the below type mapping argument
--type-mappings time-span=TimeSpan
The problem here is that the non nullable fields comes fine in the SDK generated but the nullable field comes as non nullable itself. Below is the C# code that was generated
Description
I have below two properties
but since I can't generate SDK with same timespan field from the swagger json I added below line to startup class
The json generated also looks good
I then pass the below type mapping argument
--type-mappings time-span=TimeSpan
The problem here is that the non nullable fields comes fine in the SDK generated but the nullable field comes as non nullable itself. Below is the C# code that was generated
openapi-generator version
6.2.1
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/4951