microsoft/kiota

Default date/time values generate invalid code

Open

#6251 aperta il 10 mar 2025

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)C# (326 fork)auto 404
.NETCsharphelp wantedpriority:p2type:bug

Metriche repository

Star
 (3783 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

When generating an API with default time values, the defaults are strings, which causes invalid code to be generated.

The following segment:

"time": {
    "type": "string",
    "description": "The end time in ISO8601 (HH:mm:ss) format.",
    "format": "time",
    "default": "24:00:00",
    "example": "13:00:00"
}

generates the following:

public Time? Time { get; set; }

public ScheduledTimeSpan_end()
{
    Time = "24:00:00";
}

... which is a compile error.

repro.zip

.... also, date values don't have any defaults written at all...

Guida contributor