Encountering issues with generating enums
and DateTime
attributes using Nswag and OpenApi.
First concern is regarding the Enums generation, aiming for a specific format like:
export enum BillboardType {
BB = 0,
BB18 = 1,
Direction = 2,
Banner = 3
}
However, the outcome from open api cli ends up being:
export enum BillboardType {
NUMBER_0 = 0,
NUMBER_1 = 1,
NUMBER_2 = 2,
NUMBER_3
}
Second issue pertains to how DateFormat
attributes are being generated. Would prefer them to be of Date type rather than string type.
export interface BillboardBasicInformationDto {
city?: string | null;
...
mapUrl?: string | null;
}
public class BillboardBasicInformationDto
{
public string? City { get; set; }
...
public DateTime BillboardStatusDateFrom { get; set; }
public DateTime? BillboardStatusDateTo { get; set; }
...
}
Contents of config.nswag
:
{
...
}
And the AddOpenApiDocument
configuration:
services.AddOpenApiDocument((configure, sp) =>
{
...
});
Appreciate any guidance and apologies for any oversights.
Various attempts have been made to achieve the desired enum format without success.