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
Both @mikekistler and I have observed this bug while interacting with the new JsonNode-based example APIs in v2. The current logic tries to eagerly parse string JsonNodes as date times and write them as such when emitting the final document:
{// order matters, DTO needs to be checked first!!!
writer.WriteValue(dateTime);
}
else
{
writer.WriteValue(strValue);
}
}
}
This can cause some rather unintended behaviors. For example, the current implementation casts example strings that are designated as a DateOnly time to DateTime based types. The current implementation will also errenously capture certain string examples (like a float 3.14) as dates.
Both @mikekistler and I have observed this bug while interacting with the new JsonNode-based example APIs in v2. The current logic tries to eagerly parse string JsonNodes as date times and write them as such when emitting the final document:
OpenAPI.NET/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs
Lines 118 to 144 in e917e4c
This can cause some rather unintended behaviors. For example, the current implementation casts example strings that are designated as a
DateOnly
time toDateTime
based types. The current implementation will also errenously capture certain string examples (like a float3.14
) as dates.The following code:
Produces:
When I would expect it to produce:
The text was updated successfully, but these errors were encountered: