oprava datumu: prijem data bez zony jako UTC
SDK validuje Post/Patch modely pred odeslanim a u kazde polozky DateTime vyzaduje Kind == Utc. Datum bez zony, napriklad "2026-08-25", nacetl Newtonsoft jako Unspecified, takze POST /issued-invoices koncil chybou "DateTime must be in UTC format" jeste pred volanim iDokladu. - DateTimeZoneHandling.Utc: hodnota bez zony dostane Kind Utc bez posunu, hodnota s offsetem se prepocita do UTC - ExceptionHandlingMiddleware zachytava IdokladValidationException a vraci 400 se seznamem vadnych vlastnosti misto prazdne 500 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2f3afb6af0
commit
73f01d0228
@@ -49,6 +49,13 @@ builder.Services
|
||||
{
|
||||
options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
|
||||
|
||||
// The SDK validates every DateTime member of a Post/Patch model with a UTC check and
|
||||
// rejects the model when Kind is not Utc. Newtonsoft's default (RoundtripKind) leaves a
|
||||
// date without a zone, e.g. "2026-08-25", as Unspecified, so such a request failed
|
||||
// validation before it ever reached iDoklad. Utc marks the value as UTC without shifting
|
||||
// it and converts values that do carry an offset.
|
||||
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
|
||||
|
||||
// Some IdokladSdk converters attached to model members only support reading (their
|
||||
// WriteJson throws NotImplementedException), which makes responses carrying such models
|
||||
// fail. The resolver bypasses them on the write path; the existing naming strategy is
|
||||
|
||||
Reference in New Issue
Block a user