microsoft/kiota

Default date/time values generate invalid code

Open

#6,251 opened on 2025年3月10日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)C# (326 forks)auto 404
.NETCsharphelp wantedpriority:p2type:bug

Repository metrics

Stars
 (3,783 stars)
PR merge metrics
 (PR metrics pending)

説明

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...

コントリビューターガイド