From e895a13c1dc42c2c7b0f734258af3c8a0dc21c45 Mon Sep 17 00:00:00 2001 From: rkodev <43806892+rkodev@users.noreply.github.com> Date: Mon, 17 Feb 2025 16:50:09 +0300 Subject: [PATCH] fix: corrects SerializationWriter.writeByteArrayValue to ensure consistency with other method writers --- .../abstractions/src/serialization/serializationWriter.ts | 2 +- packages/serialization/json/src/jsonSerializationWriter.ts | 2 +- .../multipart/src/multipartSerializationWriter.ts | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/abstractions/src/serialization/serializationWriter.ts b/packages/abstractions/src/serialization/serializationWriter.ts index 9d32ce52d..c0b45e870 100644 --- a/packages/abstractions/src/serialization/serializationWriter.ts +++ b/packages/abstractions/src/serialization/serializationWriter.ts @@ -19,7 +19,7 @@ export interface SerializationWriter { * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeByteArrayValue(key?: string, value?: ArrayBuffer): void; + writeByteArrayValue(key?: string, value?: ArrayBuffer | null): void; /** * Writes the specified string value to the stream with an optional given key. * @param key the key to write the value with. diff --git a/packages/serialization/json/src/jsonSerializationWriter.ts b/packages/serialization/json/src/jsonSerializationWriter.ts index 6922fb537..3bc14a865 100644 --- a/packages/serialization/json/src/jsonSerializationWriter.ts +++ b/packages/serialization/json/src/jsonSerializationWriter.ts @@ -9,7 +9,7 @@ import { DateOnly, Duration, type Guid, isUntypedNode, type ModelSerializerFunction, type Parsable, type SerializationWriter, TimeOnly, type UntypedNode, isUntypedBoolean, isUntypedString, isUntypedNull, isUntypedNumber, isUntypedObject, isUntypedArray, inNodeEnv } from "@microsoft/kiota-abstractions"; export class JsonSerializationWriter implements SerializationWriter { - public writeByteArrayValue(key?: string, value?: ArrayBuffer): void { + public writeByteArrayValue(key?: string, value?: ArrayBuffer | null): void { if (!value) { throw new Error("value cannot be undefined"); } diff --git a/packages/serialization/multipart/src/multipartSerializationWriter.ts b/packages/serialization/multipart/src/multipartSerializationWriter.ts index b610dac89..6f9df176d 100644 --- a/packages/serialization/multipart/src/multipartSerializationWriter.ts +++ b/packages/serialization/multipart/src/multipartSerializationWriter.ts @@ -10,11 +10,7 @@ import { type DateOnly, type Duration, type Guid, MultipartBody, type Parsable, /** Serialization writer for multipart/form-data */ export class MultipartSerializationWriter implements SerializationWriter { - public writeByteArrayValue( - key?: string, - - value?: ArrayBuffer, - ): void { + public writeByteArrayValue(key?: string, value?: ArrayBuffer | null): void { if (!value) { throw new Error("value cannot be undefined"); }