From 77c17c03c7672ad1eb29ed4acf79a672fc293692 Mon Sep 17 00:00:00 2001 From: Ruslan Ners Date: Wed, 26 Jun 2024 12:43:43 +0200 Subject: [PATCH 01/15] process null values --- .../src/serialization/parseNode.ts | 6 +-- .../src/serialization/serializationWriter.ts | 6 +-- .../serialization/json/src/jsonParseNode.ts | 6 +-- .../json/src/jsonSerializationWriter.ts | 50 ++++++++++++++----- 4 files changed, 46 insertions(+), 22 deletions(-) diff --git a/packages/abstractions/src/serialization/parseNode.ts b/packages/abstractions/src/serialization/parseNode.ts index d0eaafc87..6cef1876f 100644 --- a/packages/abstractions/src/serialization/parseNode.ts +++ b/packages/abstractions/src/serialization/parseNode.ts @@ -20,7 +20,7 @@ export interface ParseNode { * Gets the string value of the node. * @return the string value of the node. */ - getStringValue(): string | undefined; + getStringValue(): string | null | undefined; /** * Gets a new parse node for the given identifier. * @param identifier the identifier of the current node property. @@ -31,12 +31,12 @@ export interface ParseNode { * Gets the boolean value of the node. * @return the boolean value of the node. */ - getBooleanValue(): boolean | undefined; + getBooleanValue(): boolean | null | undefined; /** * Gets the Number value of the node. * @return the Number value of the node. */ - getNumberValue(): number | undefined; + getNumberValue(): number | null | undefined; /** * Gets the Guid value of the node. * @return the Guid value of the node. diff --git a/packages/abstractions/src/serialization/serializationWriter.ts b/packages/abstractions/src/serialization/serializationWriter.ts index 07ae8faa1..804efe36b 100644 --- a/packages/abstractions/src/serialization/serializationWriter.ts +++ b/packages/abstractions/src/serialization/serializationWriter.ts @@ -25,19 +25,19 @@ export interface SerializationWriter { * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeStringValue(key?: string | undefined, value?: string | undefined): void; + writeStringValue(key?: string | undefined, value?: string | null | undefined): void; /** * Writes the specified boolean value to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeBooleanValue(key?: string | undefined, value?: boolean | undefined): void; + writeBooleanValue(key?: string | undefined, value?: boolean | null | undefined): void; /** * Writes the specified number value to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeNumberValue(key?: string | undefined, value?: number | undefined): void; + writeNumberValue(key?: string | undefined, value?: number | null | undefined): void; /** * Writes the specified Guid 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/jsonParseNode.ts b/packages/serialization/json/src/jsonParseNode.ts index 7be3e6b2e..a4060b9e3 100644 --- a/packages/serialization/json/src/jsonParseNode.ts +++ b/packages/serialization/json/src/jsonParseNode.ts @@ -11,10 +11,10 @@ export class JsonParseNode implements ParseNode { constructor(private readonly _jsonNode: unknown) {} public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = () => (typeof this._jsonNode === "string" ? (this._jsonNode as string) : undefined); + public getStringValue = () => (typeof this._jsonNode === "string" || this._jsonNode == null ? this._jsonNode : undefined); public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); - public getBooleanValue = () => (typeof this._jsonNode === "boolean" ? (this._jsonNode as boolean) : undefined); - public getNumberValue = () => (typeof this._jsonNode === "number" ? (this._jsonNode as number) : undefined); + public getBooleanValue = () => (typeof this._jsonNode === "boolean" || this._jsonNode == null ? this._jsonNode : undefined); + public getNumberValue = () => (typeof this._jsonNode === "number" || this._jsonNode == null ? this._jsonNode : undefined); public getGuidValue = () => parseGuidString(this.getStringValue()); public getDateValue = () => (this._jsonNode ? new Date(this._jsonNode as string) : undefined); public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); diff --git a/packages/serialization/json/src/jsonSerializationWriter.ts b/packages/serialization/json/src/jsonSerializationWriter.ts index 0ffa671b9..1149992da 100644 --- a/packages/serialization/json/src/jsonSerializationWriter.ts +++ b/packages/serialization/json/src/jsonSerializationWriter.ts @@ -22,29 +22,53 @@ export class JsonSerializationWriter implements SerializationWriter { public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; - public writeStringValue = (key?: string, value?: string): void => { - if (value !== null && value !== undefined) { - key && this.writePropertyName(key); - this.writer.push(JSON.stringify(value)); - key && this.writer.push(JsonSerializationWriter.propertySeparator); + public writeStringValue = (key?: string, value?: string | null): void => { + if (value === undefined) { + return; + } + + if (value === null) { + key && this.writeNullValue(key); + + return; } + + key && this.writePropertyName(key); + this.writer.push(JSON.stringify(value)); + key && this.writer.push(JsonSerializationWriter.propertySeparator); }; private writePropertyName = (key: string): void => { this.writer.push(`"${key}":`); }; public writeBooleanValue = (key?: string, value?: boolean): void => { - if (value !== null && value !== undefined) { - key && this.writePropertyName(key); - this.writer.push(`${value}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); + if (value === undefined) { + return; + } + + if (value === null) { + key && this.writeNullValue(key); + + return; } + + key && this.writePropertyName(key); + this.writer.push(`${value}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); }; public writeNumberValue = (key?: string, value?: number): void => { - if (value !== null && value !== undefined) { - key && this.writePropertyName(key); - this.writer.push(`${value}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); + if (value === undefined) { + return; } + + if (value === null) { + key && this.writeNullValue(key); + + return; + } + + key && this.writePropertyName(key); + this.writer.push(`${value}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); }; public writeGuidValue = (key?: string, value?: Guid): void => { if (value) { From 517b3634fc6007130b6b01ce8c2934e89cb58dd8 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Thu, 27 Jun 2024 14:40:30 +0200 Subject: [PATCH 02/15] fix comments and add tests --- .../src/serialization/parseNode.ts | 16 ++++----- .../serializationFunctionTypes.ts | 4 +-- .../src/serialization/serializationWriter.ts | 16 ++++----- .../serialization/json/src/jsonParseNode.ts | 30 ++++++++++------ .../json/src/jsonSerializationWriter.ts | 32 ++++++++++++----- .../json/test/common/JsonParseNode.ts | 34 ++++++++++++++++++- .../test/common/jsonSerializationWriter.ts | 34 +++++++++++++++++++ .../json/test/common/testEntity.ts | 18 +++++----- 8 files changed, 138 insertions(+), 46 deletions(-) diff --git a/packages/abstractions/src/serialization/parseNode.ts b/packages/abstractions/src/serialization/parseNode.ts index 6cef1876f..9bc7b2047 100644 --- a/packages/abstractions/src/serialization/parseNode.ts +++ b/packages/abstractions/src/serialization/parseNode.ts @@ -26,7 +26,7 @@ export interface ParseNode { * @param identifier the identifier of the current node property. * @return a new parse node for the given identifier. */ - getChildNode(identifier: string): ParseNode | undefined; + getChildNode(identifier: string): ParseNode | null | undefined; /** * Gets the boolean value of the node. * @return the boolean value of the node. @@ -41,37 +41,37 @@ export interface ParseNode { * Gets the Guid value of the node. * @return the Guid value of the node. */ - getGuidValue(): Guid | undefined; + getGuidValue(): Guid | null | undefined; /** * Gets the Date value of the node. * @return the Date value of the node. */ - getDateValue(): Date | undefined; + getDateValue(): Date | null | undefined; /** * Gets the Duration value of the node. * @return the Duration value of the node. */ - getDurationValue(): Duration | undefined; + getDurationValue(): Duration | null | undefined; /** * Gets the DateOnly value of the node. * @return the DateOnly value of the node. */ - getDateOnlyValue(): DateOnly | undefined; + getDateOnlyValue(): DateOnly | null | undefined; /** * Gets the TimeOnly value of the node. * @return the TimeOnly value of the node. */ - getTimeOnlyValue(): TimeOnly | undefined; + getTimeOnlyValue(): TimeOnly | null | undefined; /** * Gets the collection of primitive values of the node. * @return the collection of primitive values of the node. */ - getCollectionOfPrimitiveValues(): T[] | undefined; + getCollectionOfPrimitiveValues(): T[] | null | undefined; /** * Gets the collection of object values of the node. * @return the collection of object values of the node. */ - getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | undefined; + getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | null | undefined; /** * Gets the model object value of the node. diff --git a/packages/abstractions/src/serialization/serializationFunctionTypes.ts b/packages/abstractions/src/serialization/serializationFunctionTypes.ts index 920ae6130..6f961c15c 100644 --- a/packages/abstractions/src/serialization/serializationFunctionTypes.ts +++ b/packages/abstractions/src/serialization/serializationFunctionTypes.ts @@ -8,6 +8,6 @@ import type { Parsable } from "./parsable"; import type { ParseNode } from "./parseNode"; import type { SerializationWriter } from "./serializationWriter"; -export type ModelSerializerFunction = (writer: SerializationWriter, value?: Partial | undefined) => void; +export type ModelSerializerFunction = (writer: SerializationWriter, value?: Partial | null | undefined) => void; -export type DeserializeIntoModelFunction = (value?: Partial | undefined) => Record void>; +export type DeserializeIntoModelFunction = (value?: Partial | null | undefined) => Record void>; diff --git a/packages/abstractions/src/serialization/serializationWriter.ts b/packages/abstractions/src/serialization/serializationWriter.ts index 804efe36b..8dcddb8a3 100644 --- a/packages/abstractions/src/serialization/serializationWriter.ts +++ b/packages/abstractions/src/serialization/serializationWriter.ts @@ -43,37 +43,37 @@ export interface SerializationWriter { * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeGuidValue(key?: string | undefined, value?: Guid | undefined): void; + writeGuidValue(key?: string | undefined, value?: Guid | null | undefined): void; /** * Writes the specified Date value to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeDateValue(key?: string | undefined, value?: Date | undefined): void; + writeDateValue(key?: string | undefined, value?: Date | null | undefined): void; /** * Writes the specified Duration value to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeDurationValue(key?: string | undefined, value?: Duration | undefined): void; + writeDurationValue(key?: string | undefined, value?: Duration | null | undefined): void; /** * Writes the specified TimeOnly value to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeTimeOnlyValue(key?: string | undefined, value?: TimeOnly | undefined): void; + writeTimeOnlyValue(key?: string | undefined, value?: TimeOnly | null | undefined): void; /** * Writes the specified DateOnly value to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeDateOnlyValue(key?: string | undefined, value?: DateOnly | undefined): void; + writeDateOnlyValue(key?: string | undefined, value?: DateOnly | null | undefined): void; /** * Writes the specified collection of primitive values to the stream with an optional given key. * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeCollectionOfPrimitiveValues(key?: string | undefined, values?: T[] | undefined): void; + writeCollectionOfPrimitiveValues(key?: string | undefined, values?: T[] | null | undefined): void; /** * Writes the specified collection of object values to the stream with an optional given key. * @param key the key to write the value with. @@ -85,14 +85,14 @@ export interface SerializationWriter { * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeObjectValue(key?: string | undefined, value?: T | undefined, serializerMethod?: ModelSerializerFunction): void; + writeObjectValue(key?: string | undefined, value?: T | null | undefined, serializerMethod?: ModelSerializerFunction): void; /** * Writes the specified enum value to the stream with an optional given key. * @param key the key to write the value with. * @param values the value to write to the stream. */ - writeEnumValue(key?: string | undefined, ...values: (T | undefined)[]): void; + writeEnumValue(key?: string | undefined, ...values: (T | null | undefined)[]): void; /** * Writes a null value for the specified key. * @param key the key to write the value with. diff --git a/packages/serialization/json/src/jsonParseNode.ts b/packages/serialization/json/src/jsonParseNode.ts index a4060b9e3..00554bf32 100644 --- a/packages/serialization/json/src/jsonParseNode.ts +++ b/packages/serialization/json/src/jsonParseNode.ts @@ -11,15 +11,21 @@ export class JsonParseNode implements ParseNode { constructor(private readonly _jsonNode: unknown) {} public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = () => (typeof this._jsonNode === "string" || this._jsonNode == null ? this._jsonNode : undefined); - public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); - public getBooleanValue = () => (typeof this._jsonNode === "boolean" || this._jsonNode == null ? this._jsonNode : undefined); - public getNumberValue = () => (typeof this._jsonNode === "number" || this._jsonNode == null ? this._jsonNode : undefined); - public getGuidValue = () => parseGuidString(this.getStringValue()); - public getDateValue = () => (this._jsonNode ? new Date(this._jsonNode as string) : undefined); - public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); - public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); - public getDurationValue = () => Duration.parse(this.getStringValue()); + public getStringValue = () => (typeof this._jsonNode === "string" || this._jsonNode === null ? this._jsonNode : undefined); + public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode === null ? null : this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] === null ? null : (this._jsonNode as { [key: string]: any })[identifier] ?? undefined); + public getBooleanValue = () => (typeof this._jsonNode === "boolean" || this._jsonNode === null ? this._jsonNode : undefined); + public getNumberValue = () => (typeof this._jsonNode === "number" || this._jsonNode === null ? this._jsonNode : undefined); + public getGuidValue = () => (this.getStringValue() === null ? null : parseGuidString(this.getStringValue())); + public getDateValue = () => { + if (this._jsonNode === null) { + return null; + } + + return this._jsonNode ? new Date(this._jsonNode as string) : undefined; + }; + public getDateOnlyValue = () => (this.getStringValue() === null ? null : DateOnly.parse(this.getStringValue())); + public getTimeOnlyValue = () => (this.getStringValue() === null ? null : TimeOnly.parse(this.getStringValue())); + public getDurationValue = () => (this.getStringValue() === null ? null : Duration.parse(this.getStringValue())); public getCollectionOfPrimitiveValues = (): T[] | undefined => { if (!Array.isArray(this._jsonNode)) { return undefined; @@ -53,7 +59,11 @@ export class JsonParseNode implements ParseNode { } return undefined; } - public getCollectionOfObjectValues = (method: ParsableFactory): T[] | undefined => { + public getCollectionOfObjectValues = (method: ParsableFactory): T[] | null | undefined => { + if (this._jsonNode === null) { + return null; + } + if (!Array.isArray(this._jsonNode)) { return undefined; } diff --git a/packages/serialization/json/src/jsonSerializationWriter.ts b/packages/serialization/json/src/jsonSerializationWriter.ts index 1149992da..98e0805bb 100644 --- a/packages/serialization/json/src/jsonSerializationWriter.ts +++ b/packages/serialization/json/src/jsonSerializationWriter.ts @@ -40,7 +40,7 @@ export class JsonSerializationWriter implements SerializationWriter { private writePropertyName = (key: string): void => { this.writer.push(`"${key}":`); }; - public writeBooleanValue = (key?: string, value?: boolean): void => { + public writeBooleanValue = (key?: string, value?: boolean | null): void => { if (value === undefined) { return; } @@ -55,7 +55,7 @@ export class JsonSerializationWriter implements SerializationWriter { this.writer.push(`${value}`); key && this.writer.push(JsonSerializationWriter.propertySeparator); }; - public writeNumberValue = (key?: string, value?: number): void => { + public writeNumberValue = (key?: string, value?: number | null): void => { if (value === undefined) { return; } @@ -70,23 +70,34 @@ export class JsonSerializationWriter implements SerializationWriter { this.writer.push(`${value}`); key && this.writer.push(JsonSerializationWriter.propertySeparator); }; - public writeGuidValue = (key?: string, value?: Guid): void => { + public writeGuidValue = (key?: string, value?: Guid | null): void => { + if (value === null) { + key && this.writeNullValue(key); + + return; + } + if (value) { key && this.writePropertyName(key); this.writer.push(`"${value}"`); key && this.writer.push(JsonSerializationWriter.propertySeparator); } }; - public writeDateValue = (key?: string, value?: Date): void => this.writeStringValue(key, value?.toISOString()); - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => this.writeStringValue(key, value?.toString()); - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => this.writeStringValue(key, value?.toString()); - public writeDurationValue = (key?: string, value?: Duration): void => this.writeStringValue(key, value?.toString()); + public writeDateValue = (key?: string, value?: Date | null): void => this.writeStringValue(key, value === null ? null : value?.toISOString()); + public writeDateOnlyValue = (key?: string, value?: DateOnly | null): void => this.writeStringValue(key, value === null ? null : value?.toString()); + public writeTimeOnlyValue = (key?: string, value?: TimeOnly | null): void => this.writeStringValue(key, value === null ? null : value?.toString()); + public writeDurationValue = (key?: string, value?: Duration | null): void => this.writeStringValue(key, value === null ? null : value?.toString()); public writeNullValue = (key?: string): void => { key && this.writePropertyName(key); this.writer.push(`null`); key && this.writer.push(JsonSerializationWriter.propertySeparator); }; public writeCollectionOfPrimitiveValues = (key?: string, values?: T[]): void => { + if (values === null) { + key && this.writeNullValue(key); + return; + } + if (values) { key && this.writePropertyName(key); this.startArray(); @@ -99,6 +110,11 @@ export class JsonSerializationWriter implements SerializationWriter { } }; public writeCollectionOfObjectValues = (key: string, values: T[], serializerMethod: ModelSerializerFunction): void => { + if (values === null) { + key && this.writeNullValue(key); + return; + } + if (values) { key && this.writePropertyName(key); this.startArray(); @@ -238,7 +254,7 @@ export class JsonSerializationWriter implements SerializationWriter { } this.writer.push(JSON.stringify(value), JsonSerializationWriter.propertySeparator); }; - private readonly writeAnyValue = (key?: string | undefined, value?: unknown | undefined): void => { + private readonly writeAnyValue = (key?: string | undefined, value?: unknown | null | undefined): void => { if (value !== undefined && value !== null) { const valueType = typeof value; if (valueType === "boolean") { diff --git a/packages/serialization/json/test/common/JsonParseNode.ts b/packages/serialization/json/test/common/JsonParseNode.ts index 9f530dc8d..3ce1432a2 100644 --- a/packages/serialization/json/test/common/JsonParseNode.ts +++ b/packages/serialization/json/test/common/JsonParseNode.ts @@ -41,6 +41,14 @@ describe("JsonParseNode", () => { assert.equal(stringValueResult.testDate?.getTime(), jsDate.getTime()); }); + it("Test null dates staying as null", async () => { + const stringValueResult = new JsonParseNode({ + testDate: null, + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + + assert.isNull(stringValueResult.testDate); + }); + it("Test undefined dates staying as undefined", async () => { const stringValueResult = new JsonParseNode({ testDate: undefined, @@ -79,7 +87,20 @@ describe("JsonParseNode", () => { }, ], }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - assert.equal(result.foos![0].bars, undefined); + + assert.isNull(result.foos![0].bars); + }); + + it("Test an undefined collection of object values", async () => { + const result = new JsonParseNode({ + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: undefined, + }, + ], + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + assert.isUndefined(result.foos![0].bars); }); it("Test collection of object values", async () => { @@ -98,6 +119,8 @@ describe("JsonParseNode", () => { ], }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; assert.equal(result.foos![0].bars![0].propA, "property A test value"); + + assert.isNull(result.foos![0].bars![0].propC); }); it("Test collection of backed object values", async () => { @@ -254,6 +277,9 @@ describe("JsonParseNode", () => { const result4 = new JsonParseNode(1234); assert.isUndefined(result4.getStringValue()); + + const result5 = new JsonParseNode(null); + assert.isNull(result5.getStringValue()); }); it("should get number value", async () => { @@ -269,6 +295,9 @@ describe("JsonParseNode", () => { const result4 = new JsonParseNode("test value"); assert.isUndefined(result4.getNumberValue()); + + const result5 = new JsonParseNode(null); + assert.isNull(result5.getNumberValue()); }); it("should get boolean value", async () => { @@ -287,5 +316,8 @@ describe("JsonParseNode", () => { const result5 = new JsonParseNode("true"); assert.isUndefined(result5.getBooleanValue()); + + const result6 = new JsonParseNode(null); + assert.isNull(result6.getBooleanValue()); }); }); diff --git a/packages/serialization/json/test/common/jsonSerializationWriter.ts b/packages/serialization/json/test/common/jsonSerializationWriter.ts index 727f91ee1..0dc636d18 100644 --- a/packages/serialization/json/test/common/jsonSerializationWriter.ts +++ b/packages/serialization/json/test/common/jsonSerializationWriter.ts @@ -82,6 +82,40 @@ describe("JsonParseNode", () => { assert.equal(result.testComplexString, "BÅ‚onie"); }); + it("serializes null values in json body", async () => { + const inputObject: TestParser = { + testCollection: null, + testString: null, + testBoolean: null, + testComplexString: null, + testObject: null, + additionalData: { + extraData: null, + }, + id: null, + testDate: null, + testNumber: null, + testGuid: null, + }; + const writer = new JsonSerializationWriter(); + writer.writeObjectValue("", inputObject, serializeTestParser); + const serializedContent = writer.getSerializedContent(); + const decoder = new TextDecoder(); + const contentAsStr = decoder.decode(serializedContent); + + const result = JSON.parse(contentAsStr); + + assert.isNull(result.testCollection); + assert.isNull(result.testString); + assert.isNull(result.testComplexString); + assert.isNull(result.testObject); + assert.isNull(result.extraData); + assert.isNull(result.id); + assert.isNull(result.testDate); + assert.isNull(result.testNumber); + assert.isNull(result.testGuid); + }); + it("skip undefined objects from json body", async () => { const inputObject: TestParser = { testCollection: undefined, diff --git a/packages/serialization/json/test/common/testEntity.ts b/packages/serialization/json/test/common/testEntity.ts index 0f2ecbddb..43dfedf7b 100644 --- a/packages/serialization/json/test/common/testEntity.ts +++ b/packages/serialization/json/test/common/testEntity.ts @@ -11,17 +11,17 @@ import { Guid } from "guid-typescript"; const fakeBackingStore: BackingStore = {} as BackingStore; export interface TestParser { - testCollection?: string[] | undefined; - testString?: string | undefined; - testBoolean?: boolean | undefined; - testComplexString?: string | undefined; - testObject?: Record | undefined; + testCollection?: string[] | null | undefined; + testString?: string | null | undefined; + testBoolean?: boolean | null | undefined; + testComplexString?: string | null | undefined; + testObject?: Record | null | undefined; additionalData?: Record; - testDate?: Date | undefined; + testDate?: Date | null | undefined; foos?: FooResponse[] | undefined; - id?: string | undefined; - testNumber?: number | undefined; - testGuid?: Guid | undefined; + id?: string | null | undefined; + testNumber?: number | null | undefined; + testGuid?: Guid | null | undefined; } export interface TestBackedModel extends TestParser, BackedModel { backingStoreEnabled?: boolean | undefined; From ec05d8786f6ee5d63df4cae6a6d1f213d9a894b1 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Fri, 5 Jul 2024 12:36:48 +0200 Subject: [PATCH 03/15] fix comments and handle form, text serialization --- .../src/serialization/parseNode.ts | 6 +- .../serialization/form/src/formParseNode.ts | 10 +-- .../form/src/formSerializationWriter.ts | 51 ++++++++----- .../test/common/formSerializationWriter.ts | 6 +- .../serialization/form/test/testEntity.ts | 16 ++--- .../serialization/json/src/jsonParseNode.ts | 36 ++++------ .../json/src/jsonSerializationWriter.ts | 71 ++++++++++--------- .../json/test/common/JsonParseNode.ts | 32 --------- .../serialization/text/src/textParseNode.ts | 16 ++--- .../text/src/textSerializationWriter.ts | 56 ++++++++++----- 10 files changed, 153 insertions(+), 147 deletions(-) diff --git a/packages/abstractions/src/serialization/parseNode.ts b/packages/abstractions/src/serialization/parseNode.ts index 9bc7b2047..324e9c61d 100644 --- a/packages/abstractions/src/serialization/parseNode.ts +++ b/packages/abstractions/src/serialization/parseNode.ts @@ -77,18 +77,18 @@ export interface ParseNode { * Gets the model object value of the node. * @return the model object value of the node. */ - getObjectValue(parsableFactory: ParsableFactory): T; + getObjectValue(parsableFactory: ParsableFactory): T | null; /** * Gets the Enum values of the node. * @return the Enum values of the node. */ - getCollectionOfEnumValues(type: any): T[]; + getCollectionOfEnumValues(type: any): T[] | null; /** * Gets the Enum value of the node. * @return the Enum value of the node. */ - getEnumValue(type: any): T | undefined; + getEnumValue(type: any): T | null | undefined; /** * Gets the callback called before the node is deserialized. * @return the callback called before the node is deserialized. diff --git a/packages/serialization/form/src/formParseNode.ts b/packages/serialization/form/src/formParseNode.ts index 2c0c507d6..801dee35f 100644 --- a/packages/serialization/form/src/formParseNode.ts +++ b/packages/serialization/form/src/formParseNode.ts @@ -36,7 +36,7 @@ export class FormParseNode implements ParseNode { public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; public getStringValue = (): string => decodeURIComponent(this._rawString); - public getChildNode = (identifier: string): ParseNode | undefined => { + public getChildNode = (identifier: string): ParseNode | null | undefined => { if (this._fields[identifier]) { return new FormParseNode(this._fields[identifier]); } @@ -57,7 +57,7 @@ export class FormParseNode implements ParseNode { public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | undefined => { + public getCollectionOfPrimitiveValues = (): T[] | null | undefined => { return (this._rawString.split(",") as unknown[]).map((x) => { const currentParseNode = new FormParseNode(x as string); const typeOfX = typeof x; @@ -83,10 +83,10 @@ export class FormParseNode implements ParseNode { public getCollectionOfObjectValues = ( // eslint-disable-next-line @typescript-eslint/no-unused-vars parsableFactory: ParsableFactory, - ): T[] | undefined => { + ): T[] | null | undefined => { throw new Error(`serialization of collections is not supported with URI encoding`); }; - public getObjectValue = (parsableFactory: ParsableFactory): T => { + public getObjectValue = (parsableFactory: ParsableFactory): T | null => { const temp: T = {} as T; const enableBackingStore = isBackingStoreEnabled(parsableFactory(this)(temp)); const value: T = enableBackingStore ? new Proxy(temp, createBackedModelProxyHandler()) : temp; @@ -106,7 +106,7 @@ export class FormParseNode implements ParseNode { } return rawValues.split(",").map((x) => type[toFirstCharacterUpper(x)] as T); }; - public getEnumValue = (type: any): T | undefined => { + public getEnumValue = (type: any): T | null | undefined => { const values = this.getCollectionOfEnumValues(type); if (values.length > 0) { return values[0] as T; diff --git a/packages/serialization/form/src/formSerializationWriter.ts b/packages/serialization/form/src/formSerializationWriter.ts index a2870f694..893a0dfd5 100644 --- a/packages/serialization/form/src/formSerializationWriter.ts +++ b/packages/serialization/form/src/formSerializationWriter.ts @@ -14,7 +14,7 @@ export class FormSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars key?: string | undefined, // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: ArrayBuffer | undefined, + value?: ArrayBuffer | null | undefined, ): void { throw new Error("serialization of byt arrays is not supported with URI encoding"); } @@ -24,7 +24,15 @@ export class FormSerializationWriter implements SerializationWriter { public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; - public writeStringValue = (key?: string, value?: string): void => { + public writeStringValue = (key?: string, value?: string | null): void => { + if (key && value === null) { + this.writePropertyName(key); + this.writer.push(`=${encodeURIComponent("null")}`); + this.writer.push(FormSerializationWriter.propertySeparator); + + return; + } + if (key && value) { this.writePropertyName(key); this.writer.push(`=${encodeURIComponent(value)}`); @@ -34,31 +42,31 @@ export class FormSerializationWriter implements SerializationWriter { private writePropertyName = (key: string): void => { this.writer.push(encodeURIComponent(key)); }; - public writeBooleanValue = (key?: string, value?: boolean): void => { - value !== null && value !== undefined && this.writeStringValue(key, `${value}`); + public writeBooleanValue = (key?: string, value?: boolean | null): void => { + value !== undefined && this.writeStringValue(key, `${value}`); }; - public writeNumberValue = (key?: string, value?: number): void => { + public writeNumberValue = (key?: string, value?: number | null): void => { value && this.writeStringValue(key, `${value}`); }; - public writeGuidValue = (key?: string, value?: Guid): void => { + public writeGuidValue = (key?: string, value?: Guid | null): void => { value && this.writeStringValue(key, `${value}`); }; - public writeDateValue = (key?: string, value?: Date): void => { + public writeDateValue = (key?: string, value?: Date | null): void => { value && this.writeStringValue(key, value.toISOString()); }; - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { + public writeDateOnlyValue = (key?: string, value?: DateOnly | null): void => { value && this.writeStringValue(key, value.toString()); }; - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { + public writeTimeOnlyValue = (key?: string, value?: TimeOnly | null): void => { value && this.writeStringValue(key, value.toString()); }; - public writeDurationValue = (key?: string, value?: Duration): void => { + public writeDurationValue = (key?: string, value?: Duration | null): void => { value && this.writeStringValue(key, value.toString()); }; public writeNullValue = (key?: string): void => { this.writeStringValue(key, `null`); }; - public writeCollectionOfPrimitiveValues = (_key?: string, _values?: T[]): void => { + public writeCollectionOfPrimitiveValues = (_key?: string, _values?: T[] | null): void => { if (_key && _values) { _values.forEach((val) => { this.writeAnyValue(_key, val); @@ -69,14 +77,19 @@ export class FormSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars _key?: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - _values?: T[], + _values?: T[] | null, ): void => { throw new Error(`serialization of collections is not supported with URI encoding`); }; - public writeObjectValue = (key: string | undefined, value: T | undefined, serializerMethod: ModelSerializerFunction): void => { + public writeObjectValue = (key: string | undefined, value: T | null | undefined, serializerMethod: ModelSerializerFunction): void => { if (++this.depth > 0) { throw new Error(`serialization of nested objects is not supported with URI encoding`); } + + if (key && value === null) { + return this.writeNullValue(key); + } + if (value) { if (key) { this.writePropertyName(key); @@ -92,7 +105,7 @@ export class FormSerializationWriter implements SerializationWriter { key && this.writer.push(FormSerializationWriter.propertySeparator); } }; - public writeEnumValue = (key?: string | undefined, ...values: (T | undefined)[]): void => { + public writeEnumValue = (key?: string | undefined, ...values: (T | null | undefined)[]): void => { if (values.length > 0) { const rawValues = values.filter((x) => x !== undefined).map((x) => `${x}`); if (rawValues.length > 0) { @@ -121,8 +134,12 @@ export class FormSerializationWriter implements SerializationWriter { } }; - private writeAnyValue = (key?: string | undefined, value?: unknown | undefined): void => { - if (value !== null && value !== undefined) { + private writeAnyValue = (key?: string | undefined, value?: unknown | null | undefined): void => { + if (value === null) { + return this.writeNullValue(key); + } + + if (value !== undefined) { const valueType = typeof value; if (valueType === "boolean") { this.writeBooleanValue(key, value as any as boolean); @@ -141,8 +158,6 @@ export class FormSerializationWriter implements SerializationWriter { } else { throw new Error(`encountered unknown ${value} value type during serialization ${valueType} for key ${key}`); } - } else { - this.writeNullValue(key); } }; } diff --git a/packages/serialization/form/test/common/formSerializationWriter.ts b/packages/serialization/form/test/common/formSerializationWriter.ts index 2b72112dc..622091076 100644 --- a/packages/serialization/form/test/common/formSerializationWriter.ts +++ b/packages/serialization/form/test/common/formSerializationWriter.ts @@ -26,6 +26,8 @@ describe("FormSerializationWriter", () => { month: 9, day: 4, }); + testEntity.officeLocation = null; + testEntity.endWorkTime = null; testEntity.additionalData = {}; testEntity.additionalData["mobilePhone"] = null; testEntity.additionalData["accountEnabled"] = false; @@ -41,12 +43,14 @@ describe("FormSerializationWriter", () => { "birthday=2017-09-04", // Serializes dates "workDuration=PT1H", // Serializes timespans "startWorkTime=08%3A00%3A00.0000000", //Serializes times - "mobilePhone=null", // Serializes null values + "mobilePhone=null", // Serializes null values in additionalData "accountEnabled=false", "jobTitle=Author", "createdDateTime=1970-01-01T00%3A00%3A00.000Z", "deviceNames=device1", "deviceNames=device2", // Serializes collections + "officeLocation=null", // Serializes null values + "endWorkTime=null", // Serializes null values ]; const arr = form.split("&"); let count = 0; diff --git a/packages/serialization/form/test/testEntity.ts b/packages/serialization/form/test/testEntity.ts index e25a08003..cf35270b6 100644 --- a/packages/serialization/form/test/testEntity.ts +++ b/packages/serialization/form/test/testEntity.ts @@ -8,14 +8,14 @@ import type { AdditionalDataHolder, DateOnly, Duration, Parsable, ParseNode, SerializationWriter, TimeOnly } from "@microsoft/kiota-abstractions"; export interface TestEntity extends Parsable, AdditionalDataHolder { - id?: string; - birthday?: DateOnly; - createdDateTime?: Date; - workDuration?: Duration; - startWorkTime?: TimeOnly; - endWorkTime?: TimeOnly; - officeLocation?: string; - deviceNames?: string[]; + id?: string | null; + birthday?: DateOnly | null; + createdDateTime?: Date | null; + workDuration?: Duration | null; + startWorkTime?: TimeOnly | null; + endWorkTime?: TimeOnly | null; + officeLocation?: string | null; + deviceNames?: string[] | null; } export function createTestParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { if (!parseNode) throw new Error("parseNode cannot be undefined"); diff --git a/packages/serialization/json/src/jsonParseNode.ts b/packages/serialization/json/src/jsonParseNode.ts index 00554bf32..d10add10f 100644 --- a/packages/serialization/json/src/jsonParseNode.ts +++ b/packages/serialization/json/src/jsonParseNode.ts @@ -11,22 +11,16 @@ export class JsonParseNode implements ParseNode { constructor(private readonly _jsonNode: unknown) {} public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = () => (typeof this._jsonNode === "string" || this._jsonNode === null ? this._jsonNode : undefined); - public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode === null ? null : this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] === null ? null : (this._jsonNode as { [key: string]: any })[identifier] ?? undefined); - public getBooleanValue = () => (typeof this._jsonNode === "boolean" || this._jsonNode === null ? this._jsonNode : undefined); - public getNumberValue = () => (typeof this._jsonNode === "number" || this._jsonNode === null ? this._jsonNode : undefined); - public getGuidValue = () => (this.getStringValue() === null ? null : parseGuidString(this.getStringValue())); - public getDateValue = () => { - if (this._jsonNode === null) { - return null; - } - - return this._jsonNode ? new Date(this._jsonNode as string) : undefined; - }; - public getDateOnlyValue = () => (this.getStringValue() === null ? null : DateOnly.parse(this.getStringValue())); - public getTimeOnlyValue = () => (this.getStringValue() === null ? null : TimeOnly.parse(this.getStringValue())); - public getDurationValue = () => (this.getStringValue() === null ? null : Duration.parse(this.getStringValue())); - public getCollectionOfPrimitiveValues = (): T[] | undefined => { + public getStringValue = () => (typeof this._jsonNode === "string" ? (this._jsonNode as string) : undefined); + public getChildNode = (identifier: string): ParseNode | null | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); + public getBooleanValue = () => (typeof this._jsonNode === "boolean" ? (this._jsonNode as boolean) : undefined); + public getNumberValue = () => (typeof this._jsonNode === "number" ? (this._jsonNode as number) : undefined); + public getGuidValue = () => parseGuidString(this.getStringValue()); + public getDateValue = () => (this._jsonNode ? new Date(this._jsonNode as string) : undefined); + public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); + public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); + public getDurationValue = () => Duration.parse(this.getStringValue()); + public getCollectionOfPrimitiveValues = (): T[] | null | undefined => { if (!Array.isArray(this._jsonNode)) { return undefined; } @@ -52,7 +46,7 @@ export class JsonParseNode implements ParseNode { } }); }; - public getByteArrayValue(): ArrayBuffer | undefined { + public getByteArrayValue(): ArrayBuffer | null | undefined { const strValue = this.getStringValue(); if (strValue && strValue.length > 0) { return inNodeEnv() ? Buffer.from(strValue, "base64").buffer : new TextEncoder().encode(strValue); @@ -60,17 +54,13 @@ export class JsonParseNode implements ParseNode { return undefined; } public getCollectionOfObjectValues = (method: ParsableFactory): T[] | null | undefined => { - if (this._jsonNode === null) { - return null; - } - if (!Array.isArray(this._jsonNode)) { return undefined; } return this._jsonNode ? (this._jsonNode as unknown[]).map((x) => new JsonParseNode(x)).map((x) => x.getObjectValue(method)) : undefined; }; - public getObjectValue = (parsableFactory: ParsableFactory): T => { + public getObjectValue = (parsableFactory: ParsableFactory): T | null => { const temp: T = {} as T; if (isUntypedNode(parsableFactory(this)(temp))) { const valueType = typeof this._jsonNode; @@ -135,7 +125,7 @@ export class JsonParseNode implements ParseNode { } return []; }; - public getEnumValue = (type: any): T | undefined => { + public getEnumValue = (type: any): T | null | undefined => { const rawValue = this.getStringValue(); if (!rawValue) { return undefined; diff --git a/packages/serialization/json/src/jsonSerializationWriter.ts b/packages/serialization/json/src/jsonSerializationWriter.ts index 98e0805bb..b1788a05b 100644 --- a/packages/serialization/json/src/jsonSerializationWriter.ts +++ b/packages/serialization/json/src/jsonSerializationWriter.ts @@ -92,7 +92,7 @@ export class JsonSerializationWriter implements SerializationWriter { this.writer.push(`null`); key && this.writer.push(JsonSerializationWriter.propertySeparator); }; - public writeCollectionOfPrimitiveValues = (key?: string, values?: T[]): void => { + public writeCollectionOfPrimitiveValues = (key?: string, values?: T[] | null): void => { if (values === null) { key && this.writeNullValue(key); return; @@ -109,8 +109,8 @@ export class JsonSerializationWriter implements SerializationWriter { key && this.writer.push(JsonSerializationWriter.propertySeparator); } }; - public writeCollectionOfObjectValues = (key: string, values: T[], serializerMethod: ModelSerializerFunction): void => { - if (values === null) { + public writeCollectionOfObjectValues = (key: string, values: T[] | null, serializerMethod: ModelSerializerFunction): void => { + if (values === null) { key && this.writeNullValue(key); return; } @@ -131,14 +131,15 @@ export class JsonSerializationWriter implements SerializationWriter { } }; - public writeObjectValue(key: string | undefined, value: T, serializerMethod: ModelSerializerFunction): void { - if (value === null) { - this.writeNullValue(key); - return; - } + public writeObjectValue(key: string | undefined, value: T | null, serializerMethod: ModelSerializerFunction): void { if (value === undefined) { return; } + + if (value === null) { + return this.writeNullValue(key); + } + if (isUntypedNode(value)) { const untypedNode = value as UntypedNode; if (isUntypedBoolean(untypedNode)) { @@ -217,7 +218,7 @@ export class JsonSerializationWriter implements SerializationWriter { } }; - public writeEnumValue = (key?: string | undefined, ...values: (T | undefined)[]): void => { + public writeEnumValue = (key?: string | undefined, ...values: (T | undefined | null)[]): void => { if (values.length > 0) { const rawValues = values.filter((x) => x !== undefined).map((x) => `${x}`); if (rawValues.length > 0) { @@ -255,31 +256,35 @@ export class JsonSerializationWriter implements SerializationWriter { this.writer.push(JSON.stringify(value), JsonSerializationWriter.propertySeparator); }; private readonly writeAnyValue = (key?: string | undefined, value?: unknown | null | undefined): void => { - if (value !== undefined && value !== null) { - const valueType = typeof value; - if (valueType === "boolean") { - this.writeBooleanValue(key, value as any as boolean); - } else if (valueType === "string") { - this.writeStringValue(key, value as any as string); - } else if (value instanceof Date) { - this.writeDateValue(key, value as any as Date); - } else if (value instanceof DateOnly) { - this.writeDateOnlyValue(key, value as any as DateOnly); - } else if (value instanceof TimeOnly) { - this.writeTimeOnlyValue(key, value as any as TimeOnly); - } else if (value instanceof Duration) { - this.writeDurationValue(key, value as any as Duration); - } else if (valueType === "number") { - this.writeNumberValue(key, value as any as number); - } else if (Array.isArray(value)) { - this.writeCollectionOfPrimitiveValues(key, value); - } else if (valueType === "object") { - this.writeNonParsableObjectValue(key, value as any as object); - } else { - throw new Error(`encountered unknown value type during serialization ${valueType}`); - } + if (value === undefined) { + return; + } + + if (value === null) { + return this.writeNullValue(key); + } + + const valueType = typeof value; + if (valueType === "boolean") { + this.writeBooleanValue(key, value as any as boolean); + } else if (valueType === "string") { + this.writeStringValue(key, value as any as string); + } else if (value instanceof Date) { + this.writeDateValue(key, value as any as Date); + } else if (value instanceof DateOnly) { + this.writeDateOnlyValue(key, value as any as DateOnly); + } else if (value instanceof TimeOnly) { + this.writeTimeOnlyValue(key, value as any as TimeOnly); + } else if (value instanceof Duration) { + this.writeDurationValue(key, value as any as Duration); + } else if (valueType === "number") { + this.writeNumberValue(key, value as any as number); + } else if (Array.isArray(value)) { + this.writeCollectionOfPrimitiveValues(key, value); + } else if (valueType === "object") { + this.writeNonParsableObjectValue(key, value as any as object); } else { - this.writeNullValue(key); + throw new Error(`encountered unknown value type during serialization ${valueType}`); } }; } diff --git a/packages/serialization/json/test/common/JsonParseNode.ts b/packages/serialization/json/test/common/JsonParseNode.ts index 3ce1432a2..53b44dc3c 100644 --- a/packages/serialization/json/test/common/JsonParseNode.ts +++ b/packages/serialization/json/test/common/JsonParseNode.ts @@ -41,14 +41,6 @@ describe("JsonParseNode", () => { assert.equal(stringValueResult.testDate?.getTime(), jsDate.getTime()); }); - it("Test null dates staying as null", async () => { - const stringValueResult = new JsonParseNode({ - testDate: null, - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - - assert.isNull(stringValueResult.testDate); - }); - it("Test undefined dates staying as undefined", async () => { const stringValueResult = new JsonParseNode({ testDate: undefined, @@ -78,19 +70,6 @@ describe("JsonParseNode", () => { assert.equal(enumValueResult, TestEnumObject.A); }); - it("Test a null collection of object values", async () => { - const result = new JsonParseNode({ - foos: [ - { - id: "b089d1f1-e527-4b8a-ba96-094922af6e40", - bars: null, - }, - ], - }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - - assert.isNull(result.foos![0].bars); - }); - it("Test an undefined collection of object values", async () => { const result = new JsonParseNode({ foos: [ @@ -119,8 +98,6 @@ describe("JsonParseNode", () => { ], }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; assert.equal(result.foos![0].bars![0].propA, "property A test value"); - - assert.isNull(result.foos![0].bars![0].propC); }); it("Test collection of backed object values", async () => { @@ -277,9 +254,6 @@ describe("JsonParseNode", () => { const result4 = new JsonParseNode(1234); assert.isUndefined(result4.getStringValue()); - - const result5 = new JsonParseNode(null); - assert.isNull(result5.getStringValue()); }); it("should get number value", async () => { @@ -295,9 +269,6 @@ describe("JsonParseNode", () => { const result4 = new JsonParseNode("test value"); assert.isUndefined(result4.getNumberValue()); - - const result5 = new JsonParseNode(null); - assert.isNull(result5.getNumberValue()); }); it("should get boolean value", async () => { @@ -316,8 +287,5 @@ describe("JsonParseNode", () => { const result5 = new JsonParseNode("true"); assert.isUndefined(result5.getBooleanValue()); - - const result6 = new JsonParseNode(null); - assert.isNull(result6.getBooleanValue()); }); }); diff --git a/packages/serialization/text/src/textParseNode.ts b/packages/serialization/text/src/textParseNode.ts index d3f359059..74b5ad656 100644 --- a/packages/serialization/text/src/textParseNode.ts +++ b/packages/serialization/text/src/textParseNode.ts @@ -17,7 +17,7 @@ export class TextParseNode implements ParseNode { this.text = this.text.substring(1, this.text.length - 2); } } - public getByteArrayValue(): ArrayBuffer | undefined { + public getByteArrayValue(): ArrayBuffer | null | undefined { const strValue = this.getStringValue(); if (strValue && strValue.length > 0) { return inNodeEnv() ? Buffer.from(strValue, "base64").buffer : new TextEncoder().encode(strValue); @@ -28,10 +28,10 @@ export class TextParseNode implements ParseNode { public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; public getStringValue = () => this.text; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getChildNode = (identifier: string): ParseNode | undefined => { + public getChildNode = (identifier: string): ParseNode | null | undefined => { throw new Error(TextParseNode.noStructuredDataMessage); }; - public getBooleanValue = (): boolean | undefined => { + public getBooleanValue = (): boolean | null | undefined => { const value = this.getStringValue()?.toLowerCase(); if (value === "true" || value === "1") { return true; @@ -46,24 +46,24 @@ export class TextParseNode implements ParseNode { public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | undefined => { + public getCollectionOfPrimitiveValues = (): T[] | null | undefined => { throw new Error(TextParseNode.noStructuredDataMessage); }; /* eslint-disable @typescript-eslint/no-unused-vars */ - public getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | undefined { + public getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | null | undefined { throw new Error(TextParseNode.noStructuredDataMessage); } /* eslint-disable @typescript-eslint/no-unused-vars */ - public getObjectValue(parsableFactory: ParsableFactory): T { + public getObjectValue(parsableFactory: ParsableFactory): T | null { throw new Error(TextParseNode.noStructuredDataMessage); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getCollectionOfEnumValues = (type: any): T[] => { + public getCollectionOfEnumValues = (type: any): T[] | null => { throw new Error(TextParseNode.noStructuredDataMessage); }; - public getEnumValue = (type: any): T | undefined => { + public getEnumValue = (type: any): T | null | undefined => { return type[toFirstCharacterUpper(this.text)] as T; }; } diff --git a/packages/serialization/text/src/textSerializationWriter.ts b/packages/serialization/text/src/textSerializationWriter.ts index 437980c00..87c4b7a40 100644 --- a/packages/serialization/text/src/textSerializationWriter.ts +++ b/packages/serialization/text/src/textSerializationWriter.ts @@ -10,7 +10,7 @@ import { inNodeEnv, type DateOnly, type Duration, type ModelSerializerFunction, import type { Guid } from "guid-typescript"; export class TextSerializationWriter implements SerializationWriter { - public writeByteArrayValue(key?: string | undefined, value?: ArrayBuffer | undefined): void { + public writeByteArrayValue(key?: string | undefined, value?: ArrayBuffer | null | undefined): void { if (!value) { throw new Error("value cannot be undefined"); } @@ -19,15 +19,15 @@ export class TextSerializationWriter implements SerializationWriter { this.writeStringValue(key, b64); } private static noStructuredDataMessage = "text does not support structured data"; - private readonly writer: string[] = []; + private readonly writer: (string | null)[] = []; public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; - public writeStringValue = (key?: string, value?: string): void => { + public writeStringValue = (key?: string, value?: string | null): void => { if (key || key !== "") { throw new Error(TextSerializationWriter.noStructuredDataMessage); } - if (value) { + if (value !== undefined) { if (this.writer.length > 0) { throw new Error("a value was already written for this serialization writer, text content only supports a single value"); } else { @@ -35,37 +35,61 @@ export class TextSerializationWriter implements SerializationWriter { } } }; - public writeBooleanValue = (key?: string, value?: boolean): void => { - if (value !== null && value !== undefined) { + public writeBooleanValue = (key?: string, value?: boolean | null): void => { + if (value !== undefined) { this.writeStringValue(key, `${value}`); } }; - public writeNumberValue = (key?: string, value?: number): void => { + public writeNumberValue = (key?: string, value?: number | null): void => { + if (value === null) { + return this.writeNullValue(key); + } + if (value) { this.writeStringValue(key, `${value}`); } }; - public writeGuidValue = (key?: string, value?: Guid): void => { + public writeGuidValue = (key?: string, value?: Guid | null): void => { + if (value === null) { + return this.writeNullValue(key); + } + if (value) { this.writeStringValue(key, `"${value}"`); } }; - public writeDateValue = (key?: string, value?: Date): void => { + public writeDateValue = (key?: string, value?: Date | null): void => { + if (value === null) { + return this.writeNullValue(key); + } + if (value) { this.writeStringValue(key, `"${value.toISOString()}"`); } }; - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { + public writeDateOnlyValue = (key?: string, value?: DateOnly | null): void => { + if (value === null) { + return this.writeNullValue(key); + } + if (value) { this.writeStringValue(key, `"${value.toString()}"`); } }; - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { + public writeTimeOnlyValue = (key?: string, value?: TimeOnly | null): void => { + if (value === null) { + return this.writeNullValue(key); + } + if (value) { this.writeStringValue(key, `"${value.toString()}"`); } }; - public writeDurationValue = (key?: string, value?: Duration): void => { + public writeDurationValue = (key?: string, value?: Duration | null): void => { + if (value === null) { + return this.writeNullValue(key); + } + if (value) { this.writeStringValue(key, `"${value.toString()}"`); } @@ -77,7 +101,7 @@ export class TextSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars key?: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - values?: T[], + values?: T[] | null, ): void => { throw new Error(TextSerializationWriter.noStructuredDataMessage); }; @@ -85,7 +109,7 @@ export class TextSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars key?: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - values?: T[], + values?: T[] | null, serializerMethod?: ModelSerializerFunction, ): void => { throw new Error(TextSerializationWriter.noStructuredDataMessage); @@ -94,12 +118,12 @@ export class TextSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars key?: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - value?: T, + value?: T | null, serializerMethod?: ModelSerializerFunction, ): void => { throw new Error(TextSerializationWriter.noStructuredDataMessage); }; - public writeEnumValue = (key?: string | undefined, ...values: (T | undefined)[]): void => { + public writeEnumValue = (key?: string | undefined, ...values: (T | null | undefined)[]): void => { if (values.length > 0) { const rawValues = values.filter((x) => x !== undefined).map((x) => `${x}`); if (rawValues.length > 0) { From 10bf9d6835c397125d7fbc7f124c0d0685ccd4ab Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 10 Jul 2024 12:58:03 +0200 Subject: [PATCH 04/15] handle null for multipart --- .../src/serialization/kiotaJsonSerializer.ts | 4 +-- .../src/serialization/kiotaSerializer.ts | 4 +-- .../src/multipartSerializationWriter.ts | 32 ++++++++++--------- .../common/multipartSerializationWriter.ts | 3 +- .../multipart/test/testEntity.ts | 14 ++++---- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/packages/abstractions/src/serialization/kiotaJsonSerializer.ts b/packages/abstractions/src/serialization/kiotaJsonSerializer.ts index a3a7204d9..086cfb387 100644 --- a/packages/abstractions/src/serialization/kiotaJsonSerializer.ts +++ b/packages/abstractions/src/serialization/kiotaJsonSerializer.ts @@ -56,7 +56,7 @@ export function serializeCollectionToJsonAsString(values: T[ * @param factory the factory for the model type * @returns the deserialized parsable object */ -export function deserializeFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable { +export function deserializeFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable | null { return deserialize(jsonContentType, bufferOrString, factory); } @@ -66,6 +66,6 @@ export function deserializeFromJson(bufferOrString: ArrayBuf * @param factory the factory for the model type * @returns the deserialized collection of parsable objects */ -export function deserializeCollectionFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | undefined { +export function deserializeCollectionFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | null | undefined { return deserializeCollection(jsonContentType, bufferOrString, factory); } diff --git a/packages/abstractions/src/serialization/kiotaSerializer.ts b/packages/abstractions/src/serialization/kiotaSerializer.ts index 09b08a2f2..c033826e0 100644 --- a/packages/abstractions/src/serialization/kiotaSerializer.ts +++ b/packages/abstractions/src/serialization/kiotaSerializer.ts @@ -85,7 +85,7 @@ function getStringValueFromBuffer(buffer: ArrayBuffer): string { * @param factory the factory for the model type * @returns the deserialized parsable object */ -export function deserialize(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable { +export function deserialize(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable | null { if (typeof bufferOrString === "string") { bufferOrString = getBufferFromString(bufferOrString); } @@ -111,7 +111,7 @@ function getParseNode(contentType: string, buffer: ArrayBuffer, factory: unknown * @param factory the factory for the model type * @returns the deserialized collection of parsable objects */ -export function deserializeCollection(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | undefined { +export function deserializeCollection(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | null | undefined { if (typeof bufferOrString === "string") { bufferOrString = getBufferFromString(bufferOrString); } diff --git a/packages/serialization/multipart/src/multipartSerializationWriter.ts b/packages/serialization/multipart/src/multipartSerializationWriter.ts index e0562ec76..760902bcf 100644 --- a/packages/serialization/multipart/src/multipartSerializationWriter.ts +++ b/packages/serialization/multipart/src/multipartSerializationWriter.ts @@ -30,11 +30,11 @@ export class MultipartSerializationWriter implements SerializationWriter { public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; - public writeStringValue = (key?: string, value?: string): void => { + public writeStringValue = (key?: string, value?: string | null): void => { if (key) { this.writeRawStringValue(key); } - if (value) { + if (value !== undefined) { if (key) { this.writeRawStringValue(": "); } @@ -42,37 +42,39 @@ export class MultipartSerializationWriter implements SerializationWriter { } this.writeRawStringValue("\r\n"); }; - private writeRawStringValue = (value?: string): void => { - if (value) { - this.writeByteArrayValue(undefined, new TextEncoder().encode(value).buffer); + private writeRawStringValue = (value?: string | null): void => { + if (value !== undefined) { + const isNullValue = value === null; + + this.writeByteArrayValue(undefined, new TextEncoder().encode(isNullValue ? `${value}` : value).buffer); } }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeBooleanValue = (key?: string, value?: boolean): void => { + public writeBooleanValue = (key?: string, value?: boolean | null): void => { throw new Error(`serialization of boolean values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeNumberValue = (key?: string, value?: number): void => { + public writeNumberValue = (key?: string, value?: number | null): void => { throw new Error(`serialization of number values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeGuidValue = (key?: string, value?: Guid): void => { + public writeGuidValue = (key?: string, value?: Guid | null): void => { throw new Error(`serialization of guid values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeDateValue = (key?: string, value?: Date): void => { + public writeDateValue = (key?: string, value?: Date | null): void => { throw new Error(`serialization of date values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeDateOnlyValue = (key?: string, value?: DateOnly): void => { + public writeDateOnlyValue = (key?: string, value?: DateOnly | null): void => { throw new Error(`serialization of date only values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeTimeOnlyValue = (key?: string, value?: TimeOnly): void => { + public writeTimeOnlyValue = (key?: string, value?: TimeOnly | null): void => { throw new Error(`serialization of time only values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public writeDurationValue = (key?: string, value?: Duration): void => { + public writeDurationValue = (key?: string, value?: Duration | null): void => { throw new Error(`serialization of duration values is not supported with multipart`); }; // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -83,7 +85,7 @@ export class MultipartSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars _key?: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - _values?: T[], + _values?: T[] | null, ): void => { throw new Error(`serialization of collections is not supported with multipart`); }; @@ -91,7 +93,7 @@ export class MultipartSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars _key?: string, // eslint-disable-next-line @typescript-eslint/no-unused-vars - _values?: T[], + _values?: T[] | null, ): void => { throw new Error(`serialization of collections is not supported with multipart`); }; @@ -114,7 +116,7 @@ export class MultipartSerializationWriter implements SerializationWriter { // eslint-disable-next-line @typescript-eslint/no-unused-vars key?: string | undefined, // eslint-disable-next-line @typescript-eslint/no-unused-vars - ...values: (T | undefined)[] + ...values: (T | null | undefined)[] ): void => { throw new Error(`serialization of enum values is not supported with multipart`); }; diff --git a/packages/serialization/multipart/test/common/multipartSerializationWriter.ts b/packages/serialization/multipart/test/common/multipartSerializationWriter.ts index 5b80d22ee..e3c753109 100644 --- a/packages/serialization/multipart/test/common/multipartSerializationWriter.ts +++ b/packages/serialization/multipart/test/common/multipartSerializationWriter.ts @@ -64,6 +64,7 @@ describe("MultipartSerializationWriter", () => { month: 9, day: 4, }); + testEntity.endWorkTime = null; testEntity.additionalData = {}; testEntity.additionalData["mobilePhone"] = null; testEntity.additionalData["accountEnabled"] = false; @@ -80,7 +81,7 @@ describe("MultipartSerializationWriter", () => { const multipartContent = multipartSerializationWriter.getSerializedContent(); const result = new TextDecoder().decode(multipartContent); - const expectedString = "--" + mpBody.getBoundary() + '\r\nContent-Type: application/octet-stream\r\nContent-Disposition: form-data; name="image"\r\n\r\n' + new TextDecoder().decode(byteForTest) + "\r\n--" + mpBody.getBoundary() + '\r\nContent-Type: application/json\r\nContent-Disposition: form-data; name="testEntity"\r\n\r\n{"id":"48d31887-5fad-4d73-a9f5-3c356e68a038","birthday":"2017-09-04","workDuration":"P1M","startWorkTime":"08:00:00.0000000","mobilePhone":null,"accountEnabled":false,"jobTitle":"Author","createdDateTime":"1970-01-01T00:00:00.000Z"}\r\n--' + mpBody.getBoundary() + "--\r\n"; + const expectedString = "--" + mpBody.getBoundary() + '\r\nContent-Type: application/octet-stream\r\nContent-Disposition: form-data; name="image"\r\n\r\n' + new TextDecoder().decode(byteForTest) + "\r\n--" + mpBody.getBoundary() + '\r\nContent-Type: application/json\r\nContent-Disposition: form-data; name="testEntity"\r\n\r\n{"id":"48d31887-5fad-4d73-a9f5-3c356e68a038","birthday":"2017-09-04","workDuration":"P1M","startWorkTime":"08:00:00.0000000","endWorkTime":null,"mobilePhone":null,"accountEnabled":false,"jobTitle":"Author","createdDateTime":"1970-01-01T00:00:00.000Z"}\r\n--' + mpBody.getBoundary() + "--\r\n"; assert.equal(result, expectedString); }); diff --git a/packages/serialization/multipart/test/testEntity.ts b/packages/serialization/multipart/test/testEntity.ts index 9129ff3c8..b95bbec80 100644 --- a/packages/serialization/multipart/test/testEntity.ts +++ b/packages/serialization/multipart/test/testEntity.ts @@ -8,13 +8,13 @@ import type { AdditionalDataHolder, DateOnly, Duration, Parsable, ParseNode, SerializationWriter, TimeOnly } from "@microsoft/kiota-abstractions"; export interface TestEntity extends Parsable, AdditionalDataHolder { - id?: string; - birthday?: DateOnly; - createdDateTime?: Date; - workDuration?: Duration; - startWorkTime?: TimeOnly; - endWorkTime?: TimeOnly; - officeLocation?: string; + id?: string | null; + birthday?: DateOnly | null; + createdDateTime?: Date | null; + workDuration?: Duration | null; + startWorkTime?: TimeOnly | null; + endWorkTime?: TimeOnly | null; + officeLocation?: string | null; } export function createTestParserFromDiscriminatorValue(parseNode: ParseNode | undefined) { if (!parseNode) throw new Error("parseNode cannot be undefined"); From baebc31ee6e0e43faf807c9d0b3bc200038e5758 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 10 Jul 2024 18:18:55 +0200 Subject: [PATCH 05/15] revert redundant parse node typization --- .../src/serialization/kiotaJsonSerializer.ts | 4 +-- .../src/serialization/kiotaSerializer.ts | 4 +-- .../src/serialization/parseNode.ts | 28 +++++++++---------- .../serialization/form/src/formParseNode.ts | 10 +++---- .../serialization/json/src/jsonParseNode.ts | 12 ++++---- .../json/test/common/JsonParseNode.ts | 12 ++++++++ .../src/multipartSerializationWriter.ts | 2 +- .../serialization/text/src/textParseNode.ts | 16 +++++------ .../text/src/textSerializationWriter.ts | 5 ++-- 9 files changed, 53 insertions(+), 40 deletions(-) diff --git a/packages/abstractions/src/serialization/kiotaJsonSerializer.ts b/packages/abstractions/src/serialization/kiotaJsonSerializer.ts index 086cfb387..a3a7204d9 100644 --- a/packages/abstractions/src/serialization/kiotaJsonSerializer.ts +++ b/packages/abstractions/src/serialization/kiotaJsonSerializer.ts @@ -56,7 +56,7 @@ export function serializeCollectionToJsonAsString(values: T[ * @param factory the factory for the model type * @returns the deserialized parsable object */ -export function deserializeFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable | null { +export function deserializeFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable { return deserialize(jsonContentType, bufferOrString, factory); } @@ -66,6 +66,6 @@ export function deserializeFromJson(bufferOrString: ArrayBuf * @param factory the factory for the model type * @returns the deserialized collection of parsable objects */ -export function deserializeCollectionFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | null | undefined { +export function deserializeCollectionFromJson(bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | undefined { return deserializeCollection(jsonContentType, bufferOrString, factory); } diff --git a/packages/abstractions/src/serialization/kiotaSerializer.ts b/packages/abstractions/src/serialization/kiotaSerializer.ts index c033826e0..09b08a2f2 100644 --- a/packages/abstractions/src/serialization/kiotaSerializer.ts +++ b/packages/abstractions/src/serialization/kiotaSerializer.ts @@ -85,7 +85,7 @@ function getStringValueFromBuffer(buffer: ArrayBuffer): string { * @param factory the factory for the model type * @returns the deserialized parsable object */ -export function deserialize(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable | null { +export function deserialize(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): Parsable { if (typeof bufferOrString === "string") { bufferOrString = getBufferFromString(bufferOrString); } @@ -111,7 +111,7 @@ function getParseNode(contentType: string, buffer: ArrayBuffer, factory: unknown * @param factory the factory for the model type * @returns the deserialized collection of parsable objects */ -export function deserializeCollection(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | null | undefined { +export function deserializeCollection(contentType: string, bufferOrString: ArrayBuffer | string, factory: ParsableFactory): T[] | undefined { if (typeof bufferOrString === "string") { bufferOrString = getBufferFromString(bufferOrString); } diff --git a/packages/abstractions/src/serialization/parseNode.ts b/packages/abstractions/src/serialization/parseNode.ts index 324e9c61d..d0eaafc87 100644 --- a/packages/abstractions/src/serialization/parseNode.ts +++ b/packages/abstractions/src/serialization/parseNode.ts @@ -20,75 +20,75 @@ export interface ParseNode { * Gets the string value of the node. * @return the string value of the node. */ - getStringValue(): string | null | undefined; + getStringValue(): string | undefined; /** * Gets a new parse node for the given identifier. * @param identifier the identifier of the current node property. * @return a new parse node for the given identifier. */ - getChildNode(identifier: string): ParseNode | null | undefined; + getChildNode(identifier: string): ParseNode | undefined; /** * Gets the boolean value of the node. * @return the boolean value of the node. */ - getBooleanValue(): boolean | null | undefined; + getBooleanValue(): boolean | undefined; /** * Gets the Number value of the node. * @return the Number value of the node. */ - getNumberValue(): number | null | undefined; + getNumberValue(): number | undefined; /** * Gets the Guid value of the node. * @return the Guid value of the node. */ - getGuidValue(): Guid | null | undefined; + getGuidValue(): Guid | undefined; /** * Gets the Date value of the node. * @return the Date value of the node. */ - getDateValue(): Date | null | undefined; + getDateValue(): Date | undefined; /** * Gets the Duration value of the node. * @return the Duration value of the node. */ - getDurationValue(): Duration | null | undefined; + getDurationValue(): Duration | undefined; /** * Gets the DateOnly value of the node. * @return the DateOnly value of the node. */ - getDateOnlyValue(): DateOnly | null | undefined; + getDateOnlyValue(): DateOnly | undefined; /** * Gets the TimeOnly value of the node. * @return the TimeOnly value of the node. */ - getTimeOnlyValue(): TimeOnly | null | undefined; + getTimeOnlyValue(): TimeOnly | undefined; /** * Gets the collection of primitive values of the node. * @return the collection of primitive values of the node. */ - getCollectionOfPrimitiveValues(): T[] | null | undefined; + getCollectionOfPrimitiveValues(): T[] | undefined; /** * Gets the collection of object values of the node. * @return the collection of object values of the node. */ - getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | null | undefined; + getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | undefined; /** * Gets the model object value of the node. * @return the model object value of the node. */ - getObjectValue(parsableFactory: ParsableFactory): T | null; + getObjectValue(parsableFactory: ParsableFactory): T; /** * Gets the Enum values of the node. * @return the Enum values of the node. */ - getCollectionOfEnumValues(type: any): T[] | null; + getCollectionOfEnumValues(type: any): T[]; /** * Gets the Enum value of the node. * @return the Enum value of the node. */ - getEnumValue(type: any): T | null | undefined; + getEnumValue(type: any): T | undefined; /** * Gets the callback called before the node is deserialized. * @return the callback called before the node is deserialized. diff --git a/packages/serialization/form/src/formParseNode.ts b/packages/serialization/form/src/formParseNode.ts index 801dee35f..2c0c507d6 100644 --- a/packages/serialization/form/src/formParseNode.ts +++ b/packages/serialization/form/src/formParseNode.ts @@ -36,7 +36,7 @@ export class FormParseNode implements ParseNode { public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; public getStringValue = (): string => decodeURIComponent(this._rawString); - public getChildNode = (identifier: string): ParseNode | null | undefined => { + public getChildNode = (identifier: string): ParseNode | undefined => { if (this._fields[identifier]) { return new FormParseNode(this._fields[identifier]); } @@ -57,7 +57,7 @@ export class FormParseNode implements ParseNode { public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | null | undefined => { + public getCollectionOfPrimitiveValues = (): T[] | undefined => { return (this._rawString.split(",") as unknown[]).map((x) => { const currentParseNode = new FormParseNode(x as string); const typeOfX = typeof x; @@ -83,10 +83,10 @@ export class FormParseNode implements ParseNode { public getCollectionOfObjectValues = ( // eslint-disable-next-line @typescript-eslint/no-unused-vars parsableFactory: ParsableFactory, - ): T[] | null | undefined => { + ): T[] | undefined => { throw new Error(`serialization of collections is not supported with URI encoding`); }; - public getObjectValue = (parsableFactory: ParsableFactory): T | null => { + public getObjectValue = (parsableFactory: ParsableFactory): T => { const temp: T = {} as T; const enableBackingStore = isBackingStoreEnabled(parsableFactory(this)(temp)); const value: T = enableBackingStore ? new Proxy(temp, createBackedModelProxyHandler()) : temp; @@ -106,7 +106,7 @@ export class FormParseNode implements ParseNode { } return rawValues.split(",").map((x) => type[toFirstCharacterUpper(x)] as T); }; - public getEnumValue = (type: any): T | null | undefined => { + public getEnumValue = (type: any): T | undefined => { const values = this.getCollectionOfEnumValues(type); if (values.length > 0) { return values[0] as T; diff --git a/packages/serialization/json/src/jsonParseNode.ts b/packages/serialization/json/src/jsonParseNode.ts index d10add10f..7be3e6b2e 100644 --- a/packages/serialization/json/src/jsonParseNode.ts +++ b/packages/serialization/json/src/jsonParseNode.ts @@ -12,7 +12,7 @@ export class JsonParseNode implements ParseNode { public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; public getStringValue = () => (typeof this._jsonNode === "string" ? (this._jsonNode as string) : undefined); - public getChildNode = (identifier: string): ParseNode | null | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); + public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); public getBooleanValue = () => (typeof this._jsonNode === "boolean" ? (this._jsonNode as boolean) : undefined); public getNumberValue = () => (typeof this._jsonNode === "number" ? (this._jsonNode as number) : undefined); public getGuidValue = () => parseGuidString(this.getStringValue()); @@ -20,7 +20,7 @@ export class JsonParseNode implements ParseNode { public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | null | undefined => { + public getCollectionOfPrimitiveValues = (): T[] | undefined => { if (!Array.isArray(this._jsonNode)) { return undefined; } @@ -46,21 +46,21 @@ export class JsonParseNode implements ParseNode { } }); }; - public getByteArrayValue(): ArrayBuffer | null | undefined { + public getByteArrayValue(): ArrayBuffer | undefined { const strValue = this.getStringValue(); if (strValue && strValue.length > 0) { return inNodeEnv() ? Buffer.from(strValue, "base64").buffer : new TextEncoder().encode(strValue); } return undefined; } - public getCollectionOfObjectValues = (method: ParsableFactory): T[] | null | undefined => { + public getCollectionOfObjectValues = (method: ParsableFactory): T[] | undefined => { if (!Array.isArray(this._jsonNode)) { return undefined; } return this._jsonNode ? (this._jsonNode as unknown[]).map((x) => new JsonParseNode(x)).map((x) => x.getObjectValue(method)) : undefined; }; - public getObjectValue = (parsableFactory: ParsableFactory): T | null => { + public getObjectValue = (parsableFactory: ParsableFactory): T => { const temp: T = {} as T; if (isUntypedNode(parsableFactory(this)(temp))) { const valueType = typeof this._jsonNode; @@ -125,7 +125,7 @@ export class JsonParseNode implements ParseNode { } return []; }; - public getEnumValue = (type: any): T | null | undefined => { + public getEnumValue = (type: any): T | undefined => { const rawValue = this.getStringValue(); if (!rawValue) { return undefined; diff --git a/packages/serialization/json/test/common/JsonParseNode.ts b/packages/serialization/json/test/common/JsonParseNode.ts index 53b44dc3c..46a7b56eb 100644 --- a/packages/serialization/json/test/common/JsonParseNode.ts +++ b/packages/serialization/json/test/common/JsonParseNode.ts @@ -82,6 +82,18 @@ describe("JsonParseNode", () => { assert.isUndefined(result.foos![0].bars); }); + it("Test null collection of object values", async () => { + const result = new JsonParseNode({ + foos: [ + { + id: "b089d1f1-e527-4b8a-ba96-094922af6e40", + bars: null, + }, + ], + }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; + assert.isNull(result.foos![0].bars); + }); + it("Test collection of object values", async () => { const result = new JsonParseNode({ foos: [ diff --git a/packages/serialization/multipart/src/multipartSerializationWriter.ts b/packages/serialization/multipart/src/multipartSerializationWriter.ts index 760902bcf..a2a166cab 100644 --- a/packages/serialization/multipart/src/multipartSerializationWriter.ts +++ b/packages/serialization/multipart/src/multipartSerializationWriter.ts @@ -46,7 +46,7 @@ export class MultipartSerializationWriter implements SerializationWriter { if (value !== undefined) { const isNullValue = value === null; - this.writeByteArrayValue(undefined, new TextEncoder().encode(isNullValue ? `${value}` : value).buffer); + this.writeByteArrayValue(undefined, new TextEncoder().encode(isNullValue ? "null" : value).buffer); } }; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/packages/serialization/text/src/textParseNode.ts b/packages/serialization/text/src/textParseNode.ts index 74b5ad656..d3f359059 100644 --- a/packages/serialization/text/src/textParseNode.ts +++ b/packages/serialization/text/src/textParseNode.ts @@ -17,7 +17,7 @@ export class TextParseNode implements ParseNode { this.text = this.text.substring(1, this.text.length - 2); } } - public getByteArrayValue(): ArrayBuffer | null | undefined { + public getByteArrayValue(): ArrayBuffer | undefined { const strValue = this.getStringValue(); if (strValue && strValue.length > 0) { return inNodeEnv() ? Buffer.from(strValue, "base64").buffer : new TextEncoder().encode(strValue); @@ -28,10 +28,10 @@ export class TextParseNode implements ParseNode { public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; public getStringValue = () => this.text; // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getChildNode = (identifier: string): ParseNode | null | undefined => { + public getChildNode = (identifier: string): ParseNode | undefined => { throw new Error(TextParseNode.noStructuredDataMessage); }; - public getBooleanValue = (): boolean | null | undefined => { + public getBooleanValue = (): boolean | undefined => { const value = this.getStringValue()?.toLowerCase(); if (value === "true" || value === "1") { return true; @@ -46,24 +46,24 @@ export class TextParseNode implements ParseNode { public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); public getTimeOnlyValue = () => TimeOnly.parse(this.getStringValue()); public getDurationValue = () => Duration.parse(this.getStringValue()); - public getCollectionOfPrimitiveValues = (): T[] | null | undefined => { + public getCollectionOfPrimitiveValues = (): T[] | undefined => { throw new Error(TextParseNode.noStructuredDataMessage); }; /* eslint-disable @typescript-eslint/no-unused-vars */ - public getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | null | undefined { + public getCollectionOfObjectValues(parsableFactory: ParsableFactory): T[] | undefined { throw new Error(TextParseNode.noStructuredDataMessage); } /* eslint-disable @typescript-eslint/no-unused-vars */ - public getObjectValue(parsableFactory: ParsableFactory): T | null { + public getObjectValue(parsableFactory: ParsableFactory): T { throw new Error(TextParseNode.noStructuredDataMessage); } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getCollectionOfEnumValues = (type: any): T[] | null => { + public getCollectionOfEnumValues = (type: any): T[] => { throw new Error(TextParseNode.noStructuredDataMessage); }; - public getEnumValue = (type: any): T | null | undefined => { + public getEnumValue = (type: any): T | undefined => { return type[toFirstCharacterUpper(this.text)] as T; }; } diff --git a/packages/serialization/text/src/textSerializationWriter.ts b/packages/serialization/text/src/textSerializationWriter.ts index 87c4b7a40..11dd51398 100644 --- a/packages/serialization/text/src/textSerializationWriter.ts +++ b/packages/serialization/text/src/textSerializationWriter.ts @@ -19,7 +19,7 @@ export class TextSerializationWriter implements SerializationWriter { this.writeStringValue(key, b64); } private static noStructuredDataMessage = "text does not support structured data"; - private readonly writer: (string | null)[] = []; + private readonly writer: string[] = []; public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; @@ -31,7 +31,8 @@ export class TextSerializationWriter implements SerializationWriter { if (this.writer.length > 0) { throw new Error("a value was already written for this serialization writer, text content only supports a single value"); } else { - this.writer.push(value); + const isNullValue = value === null; + this.writer.push(isNullValue ? "null" : value); } } }; From 6b023f1d19c1845ddb4a30173b65f161db3ac0b0 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Wed, 10 Jul 2024 19:08:29 +0200 Subject: [PATCH 06/15] add json parse null test --- packages/serialization/json/test/common/JsonParseNode.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/serialization/json/test/common/JsonParseNode.ts b/packages/serialization/json/test/common/JsonParseNode.ts index 46a7b56eb..656c85836 100644 --- a/packages/serialization/json/test/common/JsonParseNode.ts +++ b/packages/serialization/json/test/common/JsonParseNode.ts @@ -82,7 +82,7 @@ describe("JsonParseNode", () => { assert.isUndefined(result.foos![0].bars); }); - it("Test null collection of object values", async () => { + it.only("Test null collection of object values", async () => { const result = new JsonParseNode({ foos: [ { @@ -91,7 +91,7 @@ describe("JsonParseNode", () => { }, ], }).getObjectValue(createTestParserFromDiscriminatorValue) as TestParser; - assert.isNull(result.foos![0].bars); + assert.isUndefined(result.foos![0].bars); }); it("Test collection of object values", async () => { From aa4492eed4dc71a716d68ad0fa2c7383440168ae Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 10 Jul 2024 14:42:31 -0400 Subject: [PATCH 07/15] chore: linting --- .../serialization/json/test/common/jsonSerializationWriter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/serialization/json/test/common/jsonSerializationWriter.ts b/packages/serialization/json/test/common/jsonSerializationWriter.ts index 0dc636d18..b358b554c 100644 --- a/packages/serialization/json/test/common/jsonSerializationWriter.ts +++ b/packages/serialization/json/test/common/jsonSerializationWriter.ts @@ -105,7 +105,7 @@ describe("JsonParseNode", () => { const result = JSON.parse(contentAsStr); - assert.isNull(result.testCollection); + assert.isNull(result.testCollection); assert.isNull(result.testString); assert.isNull(result.testComplexString); assert.isNull(result.testObject); From 0f823ea323ebf41b49069ad600c516b2e4717395 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 10 Jul 2024 15:15:45 -0400 Subject: [PATCH 08/15] fix: failing null value serialization for form serialization writer Signed-off-by: Vincent Biret --- .../form/src/formSerializationWriter.ts | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/packages/serialization/form/src/formSerializationWriter.ts b/packages/serialization/form/src/formSerializationWriter.ts index 893a0dfd5..793857332 100644 --- a/packages/serialization/form/src/formSerializationWriter.ts +++ b/packages/serialization/form/src/formSerializationWriter.ts @@ -25,14 +25,9 @@ export class FormSerializationWriter implements SerializationWriter { public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; public writeStringValue = (key?: string, value?: string | null): void => { - if (key && value === null) { - this.writePropertyName(key); - this.writer.push(`=${encodeURIComponent("null")}`); - this.writer.push(FormSerializationWriter.propertySeparator); - - return; - } - + if (value === null) { + value = "null"; + } if (key && value) { this.writePropertyName(key); this.writer.push(`=${encodeURIComponent(value)}`); @@ -42,29 +37,50 @@ export class FormSerializationWriter implements SerializationWriter { private writePropertyName = (key: string): void => { this.writer.push(encodeURIComponent(key)); }; + private shouldWriteValueOrNull = (key?: string, value?: T | null): boolean => { + if (value === null) { + this.writeNullValue(key); + return false; + } + return true; + }; public writeBooleanValue = (key?: string, value?: boolean | null): void => { - value !== undefined && this.writeStringValue(key, `${value}`); + if (this.shouldWriteValueOrNull(key, value)) { + value !== undefined && this.writeStringValue(key, `${value}`); + } }; public writeNumberValue = (key?: string, value?: number | null): void => { - value && this.writeStringValue(key, `${value}`); + if (this.shouldWriteValueOrNull(key, value)) { + value && this.writeStringValue(key, `${value}`); + } }; public writeGuidValue = (key?: string, value?: Guid | null): void => { - value && this.writeStringValue(key, `${value}`); + if (this.shouldWriteValueOrNull(key, value)) { + value && this.writeStringValue(key, value.toString()); + } }; public writeDateValue = (key?: string, value?: Date | null): void => { - value && this.writeStringValue(key, value.toISOString()); + if (this.shouldWriteValueOrNull(key, value)) { + value && this.writeStringValue(key, value.toISOString()); + } }; public writeDateOnlyValue = (key?: string, value?: DateOnly | null): void => { - value && this.writeStringValue(key, value.toString()); + if (this.shouldWriteValueOrNull(key, value)) { + value && this.writeStringValue(key, value.toString()); + } }; public writeTimeOnlyValue = (key?: string, value?: TimeOnly | null): void => { - value && this.writeStringValue(key, value.toString()); + if (this.shouldWriteValueOrNull(key, value)) { + value && this.writeStringValue(key, value.toString()); + } }; public writeDurationValue = (key?: string, value?: Duration | null): void => { - value && this.writeStringValue(key, value.toString()); + if (this.shouldWriteValueOrNull(key, value)) { + value && this.writeStringValue(key, value.toString()); + } }; public writeNullValue = (key?: string): void => { - this.writeStringValue(key, `null`); + key && this.writeStringValue(key, null); }; public writeCollectionOfPrimitiveValues = (_key?: string, _values?: T[] | null): void => { if (_key && _values) { @@ -86,8 +102,8 @@ export class FormSerializationWriter implements SerializationWriter { throw new Error(`serialization of nested objects is not supported with URI encoding`); } - if (key && value === null) { - return this.writeNullValue(key); + if (!this.shouldWriteValueOrNull(key, value)) { + return; } if (value) { From 6fd7d086864e9b8c95ed04d674d6cea467b5a59c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 10 Jul 2024 15:17:11 -0400 Subject: [PATCH 09/15] chore: linting --- .../form/src/formSerializationWriter.ts | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/serialization/form/src/formSerializationWriter.ts b/packages/serialization/form/src/formSerializationWriter.ts index 793857332..3d85508fd 100644 --- a/packages/serialization/form/src/formSerializationWriter.ts +++ b/packages/serialization/form/src/formSerializationWriter.ts @@ -25,9 +25,9 @@ export class FormSerializationWriter implements SerializationWriter { public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; public writeStringValue = (key?: string, value?: string | null): void => { - if (value === null) { - value = "null"; - } + if (value === null) { + value = "null"; + } if (key && value) { this.writePropertyName(key); this.writer.push(`=${encodeURIComponent(value)}`); @@ -37,47 +37,47 @@ export class FormSerializationWriter implements SerializationWriter { private writePropertyName = (key: string): void => { this.writer.push(encodeURIComponent(key)); }; - private shouldWriteValueOrNull = (key?: string, value?: T | null): boolean => { - if (value === null) { - this.writeNullValue(key); - return false; - } - return true; - }; + private shouldWriteValueOrNull = (key?: string, value?: T | null): boolean => { + if (value === null) { + this.writeNullValue(key); + return false; + } + return true; + }; public writeBooleanValue = (key?: string, value?: boolean | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value !== undefined && this.writeStringValue(key, `${value}`); - } + value !== undefined && this.writeStringValue(key, `${value}`); + } }; public writeNumberValue = (key?: string, value?: number | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value && this.writeStringValue(key, `${value}`); - } + value && this.writeStringValue(key, `${value}`); + } }; public writeGuidValue = (key?: string, value?: Guid | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value && this.writeStringValue(key, value.toString()); - } + value && this.writeStringValue(key, value.toString()); + } }; public writeDateValue = (key?: string, value?: Date | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value && this.writeStringValue(key, value.toISOString()); - } + value && this.writeStringValue(key, value.toISOString()); + } }; public writeDateOnlyValue = (key?: string, value?: DateOnly | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value && this.writeStringValue(key, value.toString()); - } + value && this.writeStringValue(key, value.toString()); + } }; public writeTimeOnlyValue = (key?: string, value?: TimeOnly | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value && this.writeStringValue(key, value.toString()); - } + value && this.writeStringValue(key, value.toString()); + } }; public writeDurationValue = (key?: string, value?: Duration | null): void => { if (this.shouldWriteValueOrNull(key, value)) { - value && this.writeStringValue(key, value.toString()); - } + value && this.writeStringValue(key, value.toString()); + } }; public writeNullValue = (key?: string): void => { key && this.writeStringValue(key, null); From b680189be3a33076fb2eb9332599284f10293f5c Mon Sep 17 00:00:00 2001 From: Ruslan Date: Thu, 11 Jul 2024 12:20:15 +0200 Subject: [PATCH 10/15] add null helper --- .../src/serialization/serializationWriter.ts | 2 +- .../json/src/jsonSerializationWriter.ts | 65 ++++++++----------- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/packages/abstractions/src/serialization/serializationWriter.ts b/packages/abstractions/src/serialization/serializationWriter.ts index 8dcddb8a3..e87fcd8da 100644 --- a/packages/abstractions/src/serialization/serializationWriter.ts +++ b/packages/abstractions/src/serialization/serializationWriter.ts @@ -79,7 +79,7 @@ export interface SerializationWriter { * @param key the key to write the value with. * @param value the value to write to the stream. */ - writeCollectionOfObjectValues(key?: string | undefined, values?: T[], serializerMethod?: ModelSerializerFunction): void; + writeCollectionOfObjectValues(key?: string | undefined, values?: T[] | null, serializerMethod?: ModelSerializerFunction): void; /** * Writes the specified model object 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 b1788a05b..299ca29be 100644 --- a/packages/serialization/json/src/jsonSerializationWriter.ts +++ b/packages/serialization/json/src/jsonSerializationWriter.ts @@ -19,6 +19,13 @@ export class JsonSerializationWriter implements SerializationWriter { } private readonly writer: string[] = []; private static propertySeparator = `,`; + private shouldWriteValueOrNull = (key?: string, value?: T | null): boolean => { + if (value === null) { + this.writeNullValue(key); + return false; + } + return true; + }; public onBeforeObjectSerialization: ((value: Parsable) => void) | undefined; public onAfterObjectSerialization: ((value: Parsable) => void) | undefined; public onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined; @@ -27,15 +34,11 @@ export class JsonSerializationWriter implements SerializationWriter { return; } - if (value === null) { - key && this.writeNullValue(key); - - return; + if (this.shouldWriteValueOrNull(key, value)) { + key && this.writePropertyName(key); + this.writer.push(JSON.stringify(value)); + key && this.writer.push(JsonSerializationWriter.propertySeparator); } - - key && this.writePropertyName(key); - this.writer.push(JSON.stringify(value)); - key && this.writer.push(JsonSerializationWriter.propertySeparator); }; private writePropertyName = (key: string): void => { this.writer.push(`"${key}":`); @@ -45,39 +48,29 @@ export class JsonSerializationWriter implements SerializationWriter { return; } - if (value === null) { - key && this.writeNullValue(key); - - return; + if (this.shouldWriteValueOrNull(key, value)) { + key && this.writePropertyName(key); + this.writer.push(`${value}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); } - - key && this.writePropertyName(key); - this.writer.push(`${value}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); }; public writeNumberValue = (key?: string, value?: number | null): void => { if (value === undefined) { return; } - if (value === null) { - key && this.writeNullValue(key); - - return; + if (this.shouldWriteValueOrNull(key, value)) { + key && this.writePropertyName(key); + this.writer.push(`${value}`); + key && this.writer.push(JsonSerializationWriter.propertySeparator); } - - key && this.writePropertyName(key); - this.writer.push(`${value}`); - key && this.writer.push(JsonSerializationWriter.propertySeparator); }; public writeGuidValue = (key?: string, value?: Guid | null): void => { - if (value === null) { - key && this.writeNullValue(key); - + if (value === undefined) { return; } - if (value) { + if (this.shouldWriteValueOrNull(key, value)) { key && this.writePropertyName(key); this.writer.push(`"${value}"`); key && this.writer.push(JsonSerializationWriter.propertySeparator); @@ -93,8 +86,7 @@ export class JsonSerializationWriter implements SerializationWriter { key && this.writer.push(JsonSerializationWriter.propertySeparator); }; public writeCollectionOfPrimitiveValues = (key?: string, values?: T[] | null): void => { - if (values === null) { - key && this.writeNullValue(key); + if (!this.shouldWriteValueOrNull(key, values)) { return; } @@ -109,9 +101,8 @@ export class JsonSerializationWriter implements SerializationWriter { key && this.writer.push(JsonSerializationWriter.propertySeparator); } }; - public writeCollectionOfObjectValues = (key: string, values: T[] | null, serializerMethod: ModelSerializerFunction): void => { - if (values === null) { - key && this.writeNullValue(key); + public writeCollectionOfObjectValues = (key: string, values: T[] | null | undefined, serializerMethod: ModelSerializerFunction): void => { + if (!this.shouldWriteValueOrNull(key, values)) { return; } @@ -136,8 +127,8 @@ export class JsonSerializationWriter implements SerializationWriter { return; } - if (value === null) { - return this.writeNullValue(key); + if (!this.shouldWriteValueOrNull(key, value)) { + return; } if (isUntypedNode(value)) { @@ -260,8 +251,8 @@ export class JsonSerializationWriter implements SerializationWriter { return; } - if (value === null) { - return this.writeNullValue(key); + if (!this.shouldWriteValueOrNull(key, value)) { + return; } const valueType = typeof value; From 995886c5c27b1d6f34a61d6dc4705e2ef2fb4690 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 11 Jul 2024 09:59:55 -0400 Subject: [PATCH 11/15] chore: code linting Signed-off-by: Vincent Biret --- .../serialization/json/src/jsonParseNode.ts | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/serialization/json/src/jsonParseNode.ts b/packages/serialization/json/src/jsonParseNode.ts index 7be3e6b2e..c9c1c1a94 100644 --- a/packages/serialization/json/src/jsonParseNode.ts +++ b/packages/serialization/json/src/jsonParseNode.ts @@ -11,10 +11,10 @@ export class JsonParseNode implements ParseNode { constructor(private readonly _jsonNode: unknown) {} public onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined; public onAfterAssignFieldValues: ((value: Parsable) => void) | undefined; - public getStringValue = () => (typeof this._jsonNode === "string" ? (this._jsonNode as string) : undefined); - public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as { [key: string]: any })[identifier] !== undefined ? new JsonParseNode((this._jsonNode as { [key: string]: any })[identifier]) : undefined); - public getBooleanValue = () => (typeof this._jsonNode === "boolean" ? (this._jsonNode as boolean) : undefined); - public getNumberValue = () => (typeof this._jsonNode === "number" ? (this._jsonNode as number) : undefined); + public getStringValue = () => (typeof this._jsonNode === "string" ? this._jsonNode : undefined); + public getChildNode = (identifier: string): ParseNode | undefined => (this._jsonNode && typeof this._jsonNode === "object" && (this._jsonNode as Record)[identifier] !== undefined ? new JsonParseNode((this._jsonNode as Record)[identifier]) : undefined); + public getBooleanValue = () => (typeof this._jsonNode === "boolean" ? this._jsonNode : undefined); + public getNumberValue = () => (typeof this._jsonNode === "number" ? this._jsonNode : undefined); public getGuidValue = () => parseGuidString(this.getStringValue()); public getDateValue = () => (this._jsonNode ? new Date(this._jsonNode as string) : undefined); public getDateOnlyValue = () => DateOnly.parse(this.getStringValue()); @@ -66,26 +66,26 @@ export class JsonParseNode implements ParseNode { const valueType = typeof this._jsonNode; let value: T = temp; if (valueType === "boolean") { - value = createUntypedBoolean(this._jsonNode as boolean) as any as T; + value = createUntypedBoolean(this._jsonNode as boolean) as unknown as T; } else if (valueType === "string") { - value = createUntypedString(this._jsonNode as string) as any as T; + value = createUntypedString(this._jsonNode as string) as unknown as T; } else if (valueType === "number") { - value = createUntypedNumber(this._jsonNode as number) as any as T; + value = createUntypedNumber(this._jsonNode as number) as unknown as T; } else if (Array.isArray(this._jsonNode)) { const nodes: UntypedNode[] = []; // eslint-disable-next-line @typescript-eslint/no-unused-vars - (this._jsonNode as any[]).forEach((x) => { + this._jsonNode.forEach((x) => { nodes.push(new JsonParseNode(x).getObjectValue(createUntypedNodeFromDiscriminatorValue)); }); - value = createUntypedArray(nodes) as any as T; + value = createUntypedArray(nodes) as unknown as T; } else if (this._jsonNode && valueType === "object") { const properties: Record = {}; - Object.entries(this._jsonNode as any).forEach(([k, v]) => { + Object.entries(this._jsonNode).forEach(([k, v]) => { properties[k] = new JsonParseNode(v).getObjectValue(createUntypedNodeFromDiscriminatorValue); }); - value = createUntypedObject(properties) as any as T; + value = createUntypedObject(properties) as unknown as T; } else if (!this._jsonNode) { - value = createUntypedNull() as any as T; + value = createUntypedNull() as unknown as T; } return value; } @@ -104,7 +104,7 @@ export class JsonParseNode implements ParseNode { private assignFieldValues = (model: T, parsableFactory: ParsableFactory): void => { const fields = parsableFactory(this)(model); if (!this._jsonNode) return; - Object.entries(this._jsonNode as any).forEach(([k, v]) => { + Object.entries(this._jsonNode).forEach(([k, v]) => { const deserializer = fields[k]; if (deserializer) { deserializer(new JsonParseNode(v)); @@ -114,7 +114,7 @@ export class JsonParseNode implements ParseNode { } }); }; - public getCollectionOfEnumValues = (type: any): T[] => { + public getCollectionOfEnumValues = (type: unknown): T[] => { if (Array.isArray(this._jsonNode)) { return this._jsonNode .map((x) => { @@ -125,11 +125,11 @@ export class JsonParseNode implements ParseNode { } return []; }; - public getEnumValue = (type: any): T | undefined => { + public getEnumValue = (type: unknown): T | undefined => { const rawValue = this.getStringValue(); if (!rawValue) { return undefined; } - return type[toFirstCharacterUpper(rawValue)]; + return (type as Record)[toFirstCharacterUpper(rawValue)]; }; } From ec4ee728c778f6be82b782557d52163e019b66cd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 11 Jul 2024 10:19:32 -0400 Subject: [PATCH 12/15] fix: corrects deserialization function type definition Signed-off-by: Vincent Biret --- .../src/serialization/serializationFunctionTypes.ts | 2 +- packages/abstractions/src/serialization/untypedNode.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/abstractions/src/serialization/serializationFunctionTypes.ts b/packages/abstractions/src/serialization/serializationFunctionTypes.ts index 6f961c15c..f121e1e4f 100644 --- a/packages/abstractions/src/serialization/serializationFunctionTypes.ts +++ b/packages/abstractions/src/serialization/serializationFunctionTypes.ts @@ -10,4 +10,4 @@ import type { SerializationWriter } from "./serializationWriter"; export type ModelSerializerFunction = (writer: SerializationWriter, value?: Partial | null | undefined) => void; -export type DeserializeIntoModelFunction = (value?: Partial | null | undefined) => Record void>; +export type DeserializeIntoModelFunction = (value?: Partial | undefined) => Record void>; diff --git a/packages/abstractions/src/serialization/untypedNode.ts b/packages/abstractions/src/serialization/untypedNode.ts index 04d7fbdab..c06003b52 100644 --- a/packages/abstractions/src/serialization/untypedNode.ts +++ b/packages/abstractions/src/serialization/untypedNode.ts @@ -9,6 +9,8 @@ import type { Parsable } from "./parsable"; import type { ParseNode } from "./parseNode"; import type { SerializationWriter } from "./serializationWriter"; +import type { ParsableFactory } from "./parsableFactory"; +import type { DeserializeIntoModelFunction } from "./serializationFunctionTypes"; /** Defines the base interface for defining an untyped node. */ export interface UntypedNode extends Parsable { @@ -25,7 +27,7 @@ export interface UntypedNode extends Parsable { /** * Factory to create an UntypedNode from a string during deserialization. */ -export const createUntypedNodeFromDiscriminatorValue = (_parseNode: ParseNode | undefined): ((_instance?: Parsable) => Record void>) => { +export const createUntypedNodeFromDiscriminatorValue: ParsableFactory = (_parseNode: ParseNode | undefined): ((_instance?: Parsable) => Record void>) => { return deserializeIntoUntypedNode; }; @@ -42,7 +44,7 @@ export const isUntypedNode = (node: unknown): node is UntypedNode => { /** * The deserialization implementation for UntypedNode. */ -export const deserializeIntoUntypedNode = (untypedNode: Partial | undefined = {}): Record void> => { +export const deserializeIntoUntypedNode: DeserializeIntoModelFunction = (untypedNode: Partial | undefined = {}): Record void> => { return { value: (_n) => { untypedNode.value = null; From 5728dfbbe7cd476ff863d6d2581582a7908c8621 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Thu, 11 Jul 2024 17:37:41 +0200 Subject: [PATCH 13/15] remove redundant only in tests --- packages/serialization/json/test/common/JsonParseNode.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/serialization/json/test/common/JsonParseNode.ts b/packages/serialization/json/test/common/JsonParseNode.ts index 656c85836..ac588564b 100644 --- a/packages/serialization/json/test/common/JsonParseNode.ts +++ b/packages/serialization/json/test/common/JsonParseNode.ts @@ -82,7 +82,7 @@ describe("JsonParseNode", () => { assert.isUndefined(result.foos![0].bars); }); - it.only("Test null collection of object values", async () => { + it("Test null collection of object values", async () => { const result = new JsonParseNode({ foos: [ { From a94e8962e3390112a8739e3979be4e0cd914a24d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 13 Aug 2024 10:44:43 -0400 Subject: [PATCH 14/15] chore: updates generated client --- packages/test/generatedCode/apiClient.ts | 1 + packages/test/generatedCode/kiota-lock.json | 4 +- packages/test/generatedCode/models/index.ts | 374 +++++++++++------- .../generatedCode/models/oDataErrors/index.ts | 38 +- .../item/inferenceClassification/index.ts | 9 +- .../overrides/count/index.ts | 9 +- .../overrides/index.ts | 24 +- .../overrides/item/index.ts | 9 +- .../users/item/mailFolders/count/index.ts | 9 +- .../users/item/mailFolders/index.ts | 23 +- .../item/childFolders/count/index.ts | 9 +- .../mailFolders/item/childFolders/index.ts | 23 +- .../item/childFolders/item/index.ts | 6 +- .../item/messageRules/count/index.ts | 9 +- .../childFolders/item/messageRules/index.ts | 24 +- .../item/messageRules/item/index.ts | 9 +- .../childFolders/item/messages/count/index.ts | 4 +- .../item/childFolders/item/messages/index.ts | 16 +- .../messages/item/attachments/count/index.ts | 9 +- .../item/messages/item/attachments/index.ts | 27 +- .../messages/item/attachments/item/index.ts | 4 +- .../messages/item/extensions/count/index.ts | 9 +- .../item/messages/item/extensions/index.ts | 21 +- .../messages/item/extensions/item/index.ts | 4 +- .../childFolders/item/messages/item/index.ts | 4 +- .../item/messages/item/value/index.ts | 52 +-- .../users/item/mailFolders/item/index.ts | 6 +- .../item/messageRules/count/index.ts | 9 +- .../mailFolders/item/messageRules/index.ts | 24 +- .../item/messageRules/item/index.ts | 9 +- .../mailFolders/item/messages/count/index.ts | 4 +- .../item/mailFolders/item/messages/index.ts | 16 +- .../messages/item/attachments/count/index.ts | 9 +- .../item/messages/item/attachments/index.ts | 27 +- .../messages/item/attachments/item/index.ts | 4 +- .../messages/item/extensions/count/index.ts | 9 +- .../item/messages/item/extensions/index.ts | 21 +- .../messages/item/extensions/item/index.ts | 4 +- .../mailFolders/item/messages/item/index.ts | 4 +- .../item/messages/item/value/index.ts | 52 +-- .../users/item/messages/count/index.ts | 4 +- .../users/item/messages/index.ts | 18 +- .../messages/item/attachments/count/index.ts | 9 +- .../item/messages/item/attachments/index.ts | 27 +- .../messages/item/attachments/item/index.ts | 4 +- .../messages/item/extensions/count/index.ts | 9 +- .../item/messages/item/extensions/index.ts | 21 +- .../messages/item/extensions/item/index.ts | 4 +- .../users/item/messages/item/index.ts | 6 +- .../users/item/messages/item/value/index.ts | 52 +-- 50 files changed, 683 insertions(+), 399 deletions(-) diff --git a/packages/test/generatedCode/apiClient.ts b/packages/test/generatedCode/apiClient.ts index c5425d957..ccbee1dc8 100644 --- a/packages/test/generatedCode/apiClient.ts +++ b/packages/test/generatedCode/apiClient.ts @@ -27,6 +27,7 @@ export interface ApiClient extends BaseRequestBuilder { * Instantiates a new {@link ApiClient} and sets the default values. * @param requestAdapter The request adapter to use to execute the requests. */ +// @ts-ignore export function createApiClient(requestAdapter: RequestAdapter) { registerDefaultSerializer(JsonSerializationWriterFactory); registerDefaultSerializer(TextSerializationWriterFactory); diff --git a/packages/test/generatedCode/kiota-lock.json b/packages/test/generatedCode/kiota-lock.json index 1c349b3a3..d8580e9a5 100644 --- a/packages/test/generatedCode/kiota-lock.json +++ b/packages/test/generatedCode/kiota-lock.json @@ -1,8 +1,8 @@ { - "descriptionHash": "15B53EEA450FFEA381255C759A9849B94369AD6D91DCAAA7FFAE2BD687679A765FAAF7983F39DDBFF137CEB8C2652619212CE813C8BAB3E4265638626A99127E", + "descriptionHash": "CE55775E5E36A748E59FB2BA5E63C392C63AA9CC15CE23D56FB5C14B92BBFA708FF5D4386EC1532D7A7BB74C8D9E80AE6482AB3806FB0393E1DD8151FAE8FE50", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", "lockFileVersion": "1.0.0", - "kiotaVersion": "1.17.0", + "kiotaVersion": "1.18.0", "clientClassName": "ApiClient", "clientNamespaceName": "ApiSdk", "language": "TypeScript", diff --git a/packages/test/generatedCode/models/index.ts b/packages/test/generatedCode/models/index.ts index 29fb0a1d6..8fa535ad6 100644 --- a/packages/test/generatedCode/models/index.ts +++ b/packages/test/generatedCode/models/index.ts @@ -8,37 +8,37 @@ export interface Attachment extends Entity, Parsable { /** * The MIME type. */ - contentType?: string; + contentType?: string | null; /** * true if the attachment is an inline attachment; otherwise, false. */ - isInline?: boolean; + isInline?: boolean | null; /** * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z */ - lastModifiedDateTime?: Date; + lastModifiedDateTime?: Date | null; /** * The attachment's file name. */ - name?: string; + name?: string | null; /** * The length of the attachment in bytes. */ - size?: number; + size?: number | null; } export interface AttachmentCollectionResponse extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The OdataNextLink property */ - odataNextLink?: string; + odataNextLink?: string | null; /** * The value property */ - value?: Attachment[]; + value?: Attachment[] | null; } export type BodyType = (typeof BodyTypeObject)[keyof typeof BodyTypeObject]; /** @@ -46,6 +46,7 @@ export type BodyType = (typeof BodyTypeObject)[keyof typeof BodyTypeObject]; * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {AttachmentCollectionResponse} */ +// @ts-ignore export function createAttachmentCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoAttachmentCollectionResponse; } @@ -54,6 +55,7 @@ export function createAttachmentCollectionResponseFromDiscriminatorValue(parseNo * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Attachment} */ +// @ts-ignore export function createAttachmentFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoAttachment; } @@ -62,6 +64,7 @@ export function createAttachmentFromDiscriminatorValue(parseNode: ParseNode | un * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {DateTimeTimeZone} */ +// @ts-ignore export function createDateTimeTimeZoneFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoDateTimeTimeZone; } @@ -70,6 +73,7 @@ export function createDateTimeTimeZoneFromDiscriminatorValue(parseNode: ParseNod * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {EmailAddress} */ +// @ts-ignore export function createEmailAddressFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoEmailAddress; } @@ -78,6 +82,7 @@ export function createEmailAddressFromDiscriminatorValue(parseNode: ParseNode | * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Entity} */ +// @ts-ignore export function createEntityFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoEntity; } @@ -86,6 +91,7 @@ export function createEntityFromDiscriminatorValue(parseNode: ParseNode | undefi * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ExtensionCollectionResponse} */ +// @ts-ignore export function createExtensionCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoExtensionCollectionResponse; } @@ -94,6 +100,7 @@ export function createExtensionCollectionResponseFromDiscriminatorValue(parseNod * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Extension} */ +// @ts-ignore export function createExtensionFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoExtension; } @@ -102,6 +109,7 @@ export function createExtensionFromDiscriminatorValue(parseNode: ParseNode | und * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {FollowupFlag} */ +// @ts-ignore export function createFollowupFlagFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoFollowupFlag; } @@ -110,6 +118,7 @@ export function createFollowupFlagFromDiscriminatorValue(parseNode: ParseNode | * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InferenceClassification} */ +// @ts-ignore export function createInferenceClassificationFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoInferenceClassification; } @@ -118,6 +127,7 @@ export function createInferenceClassificationFromDiscriminatorValue(parseNode: P * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InferenceClassificationOverrideCollectionResponse} */ +// @ts-ignore export function createInferenceClassificationOverrideCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoInferenceClassificationOverrideCollectionResponse; } @@ -126,6 +136,7 @@ export function createInferenceClassificationOverrideCollectionResponseFromDiscr * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InferenceClassificationOverride} */ +// @ts-ignore export function createInferenceClassificationOverrideFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoInferenceClassificationOverride; } @@ -134,6 +145,7 @@ export function createInferenceClassificationOverrideFromDiscriminatorValue(pars * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InternetMessageHeader} */ +// @ts-ignore export function createInternetMessageHeaderFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoInternetMessageHeader; } @@ -142,6 +154,7 @@ export function createInternetMessageHeaderFromDiscriminatorValue(parseNode: Par * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ItemBody} */ +// @ts-ignore export function createItemBodyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoItemBody; } @@ -150,6 +163,7 @@ export function createItemBodyFromDiscriminatorValue(parseNode: ParseNode | unde * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MailFolderCollectionResponse} */ +// @ts-ignore export function createMailFolderCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMailFolderCollectionResponse; } @@ -158,6 +172,7 @@ export function createMailFolderCollectionResponseFromDiscriminatorValue(parseNo * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MailFolder} */ +// @ts-ignore export function createMailFolderFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMailFolder; } @@ -166,6 +181,7 @@ export function createMailFolderFromDiscriminatorValue(parseNode: ParseNode | un * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageCollectionResponse} */ +// @ts-ignore export function createMessageCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMessageCollectionResponse; } @@ -174,6 +190,7 @@ export function createMessageCollectionResponseFromDiscriminatorValue(parseNode: * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Message} */ +// @ts-ignore export function createMessageFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMessage; } @@ -182,6 +199,7 @@ export function createMessageFromDiscriminatorValue(parseNode: ParseNode | undef * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRuleActions} */ +// @ts-ignore export function createMessageRuleActionsFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMessageRuleActions; } @@ -190,6 +208,7 @@ export function createMessageRuleActionsFromDiscriminatorValue(parseNode: ParseN * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRuleCollectionResponse} */ +// @ts-ignore export function createMessageRuleCollectionResponseFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMessageRuleCollectionResponse; } @@ -198,6 +217,7 @@ export function createMessageRuleCollectionResponseFromDiscriminatorValue(parseN * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRule} */ +// @ts-ignore export function createMessageRuleFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMessageRule; } @@ -206,6 +226,7 @@ export function createMessageRuleFromDiscriminatorValue(parseNode: ParseNode | u * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MessageRulePredicates} */ +// @ts-ignore export function createMessageRulePredicatesFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMessageRulePredicates; } @@ -214,6 +235,7 @@ export function createMessageRulePredicatesFromDiscriminatorValue(parseNode: Par * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MultiValueLegacyExtendedProperty} */ +// @ts-ignore export function createMultiValueLegacyExtendedPropertyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMultiValueLegacyExtendedProperty; } @@ -222,6 +244,7 @@ export function createMultiValueLegacyExtendedPropertyFromDiscriminatorValue(par * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {OutlookItem} */ +// @ts-ignore export function createOutlookItemFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoOutlookItem; } @@ -230,6 +253,7 @@ export function createOutlookItemFromDiscriminatorValue(parseNode: ParseNode | u * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {Recipient} */ +// @ts-ignore export function createRecipientFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoRecipient; } @@ -238,6 +262,7 @@ export function createRecipientFromDiscriminatorValue(parseNode: ParseNode | und * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {SingleValueLegacyExtendedProperty} */ +// @ts-ignore export function createSingleValueLegacyExtendedPropertyFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoSingleValueLegacyExtendedProperty; } @@ -246,6 +271,7 @@ export function createSingleValueLegacyExtendedPropertyFromDiscriminatorValue(pa * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {SizeRange} */ +// @ts-ignore export function createSizeRangeFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoSizeRange; } @@ -253,20 +279,21 @@ export interface DateTimeTimeZone extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * A single point of time in a combined date and time representation ({date}T{time}; for example, 2017-08-29T04:00:00.0000000). */ - dateTime?: string; + dateTime?: string | null; /** * Represents a time zone, for example, 'Pacific Standard Time'. See below for more possible values. */ - timeZone?: string; + timeZone?: string | null; } /** * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoAttachment(attachment: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(attachment), @@ -281,6 +308,7 @@ export function deserializeIntoAttachment(attachment: Partial | unde * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoAttachmentCollectionResponse(attachmentCollectionResponse: Partial | undefined = {}) : Record void> { return { "@odata.nextLink": n => { attachmentCollectionResponse.odataNextLink = n.getStringValue(); }, @@ -291,6 +319,7 @@ export function deserializeIntoAttachmentCollectionResponse(attachmentCollection * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoDateTimeTimeZone(dateTimeTimeZone: Partial | undefined = {}) : Record void> { return { "dateTime": n => { dateTimeTimeZone.dateTime = n.getStringValue(); }, @@ -301,6 +330,7 @@ export function deserializeIntoDateTimeTimeZone(dateTimeTimeZone: Partial void>} */ +// @ts-ignore export function deserializeIntoEmailAddress(emailAddress: Partial | undefined = {}) : Record void> { return { "address": n => { emailAddress.address = n.getStringValue(); }, @@ -311,6 +341,7 @@ export function deserializeIntoEmailAddress(emailAddress: Partial * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoEntity(entity: Partial | undefined = {}) : Record void> { return { "id": n => { entity.id = n.getStringValue(); }, @@ -320,6 +351,7 @@ export function deserializeIntoEntity(entity: Partial | undefined = {}) * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoExtension(extension: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(extension), @@ -329,6 +361,7 @@ export function deserializeIntoExtension(extension: Partial | undefin * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoExtensionCollectionResponse(extensionCollectionResponse: Partial | undefined = {}) : Record void> { return { "@odata.nextLink": n => { extensionCollectionResponse.odataNextLink = n.getStringValue(); }, @@ -339,6 +372,7 @@ export function deserializeIntoExtensionCollectionResponse(extensionCollectionRe * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoFollowupFlag(followupFlag: Partial | undefined = {}) : Record void> { return { "completedDateTime": n => { followupFlag.completedDateTime = n.getObjectValue(createDateTimeTimeZoneFromDiscriminatorValue); }, @@ -351,6 +385,7 @@ export function deserializeIntoFollowupFlag(followupFlag: Partial * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoInferenceClassification(inferenceClassification: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(inferenceClassification), @@ -361,6 +396,7 @@ export function deserializeIntoInferenceClassification(inferenceClassification: * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoInferenceClassificationOverride(inferenceClassificationOverride: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(inferenceClassificationOverride), @@ -372,6 +408,7 @@ export function deserializeIntoInferenceClassificationOverride(inferenceClassifi * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoInferenceClassificationOverrideCollectionResponse(inferenceClassificationOverrideCollectionResponse: Partial | undefined = {}) : Record void> { return { "@odata.nextLink": n => { inferenceClassificationOverrideCollectionResponse.odataNextLink = n.getStringValue(); }, @@ -382,6 +419,7 @@ export function deserializeIntoInferenceClassificationOverrideCollectionResponse * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoInternetMessageHeader(internetMessageHeader: Partial | undefined = {}) : Record void> { return { "name": n => { internetMessageHeader.name = n.getStringValue(); }, @@ -392,6 +430,7 @@ export function deserializeIntoInternetMessageHeader(internetMessageHeader: Part * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoItemBody(itemBody: Partial | undefined = {}) : Record void> { return { "content": n => { itemBody.content = n.getStringValue(); }, @@ -402,6 +441,7 @@ export function deserializeIntoItemBody(itemBody: Partial | undefined * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMailFolder(mailFolder: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(mailFolder), @@ -422,6 +462,7 @@ export function deserializeIntoMailFolder(mailFolder: Partial | unde * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMailFolderCollectionResponse(mailFolderCollectionResponse: Partial | undefined = {}) : Record void> { return { "@odata.nextLink": n => { mailFolderCollectionResponse.odataNextLink = n.getStringValue(); }, @@ -432,6 +473,7 @@ export function deserializeIntoMailFolderCollectionResponse(mailFolderCollection * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMessage(message: Partial | undefined = {}) : Record void> { return { ...deserializeIntoOutlookItem(message), @@ -471,6 +513,7 @@ export function deserializeIntoMessage(message: Partial | undefined = { * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMessageCollectionResponse(messageCollectionResponse: Partial | undefined = {}) : Record void> { return { "@odata.nextLink": n => { messageCollectionResponse.odataNextLink = n.getStringValue(); }, @@ -481,6 +524,7 @@ export function deserializeIntoMessageCollectionResponse(messageCollectionRespon * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMessageRule(messageRule: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(messageRule), @@ -498,6 +542,7 @@ export function deserializeIntoMessageRule(messageRule: Partial | u * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMessageRuleActions(messageRuleActions: Partial | undefined = {}) : Record void> { return { "assignCategories": n => { messageRuleActions.assignCategories = n.getCollectionOfPrimitiveValues(); }, @@ -517,6 +562,7 @@ export function deserializeIntoMessageRuleActions(messageRuleActions: Partial void>} */ +// @ts-ignore export function deserializeIntoMessageRuleCollectionResponse(messageRuleCollectionResponse: Partial | undefined = {}) : Record void> { return { "@odata.nextLink": n => { messageRuleCollectionResponse.odataNextLink = n.getStringValue(); }, @@ -527,6 +573,7 @@ export function deserializeIntoMessageRuleCollectionResponse(messageRuleCollecti * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMessageRulePredicates(messageRulePredicates: Partial | undefined = {}) : Record void> { return { "bodyContains": n => { messageRulePredicates.bodyContains = n.getCollectionOfPrimitiveValues(); }, @@ -565,6 +612,7 @@ export function deserializeIntoMessageRulePredicates(messageRulePredicates: Part * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMultiValueLegacyExtendedProperty(multiValueLegacyExtendedProperty: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(multiValueLegacyExtendedProperty), @@ -575,6 +623,7 @@ export function deserializeIntoMultiValueLegacyExtendedProperty(multiValueLegacy * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoOutlookItem(outlookItem: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(outlookItem), @@ -588,6 +637,7 @@ export function deserializeIntoOutlookItem(outlookItem: Partial | u * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoRecipient(recipient: Partial | undefined = {}) : Record void> { return { "emailAddress": n => { recipient.emailAddress = n.getObjectValue(createEmailAddressFromDiscriminatorValue); }, @@ -597,6 +647,7 @@ export function deserializeIntoRecipient(recipient: Partial | undefin * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoSingleValueLegacyExtendedProperty(singleValueLegacyExtendedProperty: Partial | undefined = {}) : Record void> { return { ...deserializeIntoEntity(singleValueLegacyExtendedProperty), @@ -607,6 +658,7 @@ export function deserializeIntoSingleValueLegacyExtendedProperty(singleValueLega * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoSizeRange(sizeRange: Partial | undefined = {}) : Record void> { return { "maximumSize": n => { sizeRange.maximumSize = n.getNumberValue(); }, @@ -617,25 +669,25 @@ export interface EmailAddress extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The email address of the person or entity. */ - address?: string; + address?: string | null; /** * The display name of the person or entity. */ - name?: string; + name?: string | null; } export interface Entity extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The unique identifier for an entity. Read-only. */ - id?: string; + id?: string | null; } export interface Extension extends Entity, Parsable { } @@ -643,37 +695,37 @@ export interface ExtensionCollectionResponse extends AdditionalDataHolder, Parsa /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The OdataNextLink property */ - odataNextLink?: string; + odataNextLink?: string | null; /** * The value property */ - value?: Extension[]; + value?: Extension[] | null; } export interface FollowupFlag extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The completedDateTime property */ - completedDateTime?: DateTimeTimeZone; + completedDateTime?: DateTimeTimeZone | null; /** * The dueDateTime property */ - dueDateTime?: DateTimeTimeZone; + dueDateTime?: DateTimeTimeZone | null; /** * The flagStatus property */ - flagStatus?: FollowupFlagStatus; + flagStatus?: FollowupFlagStatus | null; /** * The startDateTime property */ - startDateTime?: DateTimeTimeZone; + startDateTime?: DateTimeTimeZone | null; } export type FollowupFlagStatus = (typeof FollowupFlagStatusObject)[keyof typeof FollowupFlagStatusObject]; export type Importance = (typeof ImportanceObject)[keyof typeof ImportanceObject]; @@ -681,521 +733,522 @@ export interface InferenceClassification extends Entity, Parsable { /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. */ - overrides?: InferenceClassificationOverride[]; + overrides?: InferenceClassificationOverride[] | null; } export interface InferenceClassificationOverride extends Entity, Parsable { /** * The classifyAs property */ - classifyAs?: InferenceClassificationType; + classifyAs?: InferenceClassificationType | null; /** * The senderEmailAddress property */ - senderEmailAddress?: EmailAddress; + senderEmailAddress?: EmailAddress | null; } export interface InferenceClassificationOverrideCollectionResponse extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The OdataNextLink property */ - odataNextLink?: string; + odataNextLink?: string | null; /** * The value property */ - value?: InferenceClassificationOverride[]; + value?: InferenceClassificationOverride[] | null; } export type InferenceClassificationType = (typeof InferenceClassificationTypeObject)[keyof typeof InferenceClassificationTypeObject]; export interface InternetMessageHeader extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * Represents the key in a key-value pair. */ - name?: string; + name?: string | null; /** * The value in a key-value pair. */ - value?: string; + value?: string | null; } export interface ItemBody extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The content of the item. */ - content?: string; + content?: string | null; /** * The contentType property */ - contentType?: BodyType; + contentType?: BodyType | null; } export interface MailFolder extends Entity, Parsable { /** * The number of immediate child mailFolders in the current mailFolder. */ - childFolderCount?: number; + childFolderCount?: number | null; /** * The collection of child folders in the mailFolder. */ - childFolders?: MailFolder[]; + childFolders?: MailFolder[] | null; /** * The mailFolder's display name. */ - displayName?: string; + displayName?: string | null; /** * Indicates whether the mailFolder is hidden. This property can be set only when creating the folder. Find more information in Hidden mail folders. */ - isHidden?: boolean; + isHidden?: boolean | null; /** * The collection of rules that apply to the user's Inbox folder. */ - messageRules?: MessageRule[]; + messageRules?: MessageRule[] | null; /** * The collection of messages in the mailFolder. */ - messages?: Message[]; + messages?: Message[] | null; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. */ - multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[]; + multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[] | null; /** * The unique identifier for the mailFolder's parent mailFolder. */ - parentFolderId?: string; + parentFolderId?: string | null; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. */ - singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[]; + singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[] | null; /** * The number of items in the mailFolder. */ - totalItemCount?: number; + totalItemCount?: number | null; /** * The number of items in the mailFolder marked as unread. */ - unreadItemCount?: number; + unreadItemCount?: number | null; } export interface MailFolderCollectionResponse extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The OdataNextLink property */ - odataNextLink?: string; + odataNextLink?: string | null; /** * The value property */ - value?: MailFolder[]; + value?: MailFolder[] | null; } export interface Message extends OutlookItem, Parsable { /** * The fileAttachment and itemAttachment attachments for the message. */ - attachments?: Attachment[]; + attachments?: Attachment[] | null; /** * The Bcc: recipients for the message. */ - bccRecipients?: Recipient[]; + bccRecipients?: Recipient[] | null; /** * The body property */ - body?: ItemBody; + body?: ItemBody | null; /** * The first 255 characters of the message body. It is in text format. */ - bodyPreview?: string; + bodyPreview?: string | null; /** * The Cc: recipients for the message. */ - ccRecipients?: Recipient[]; + ccRecipients?: Recipient[] | null; /** * The ID of the conversation the email belongs to. */ - conversationId?: string; + conversationId?: string | null; /** * Indicates the position of the message within the conversation. */ - conversationIndex?: string; + conversationIndex?: string | null; /** * The collection of open extensions defined for the message. Nullable. */ - extensions?: Extension[]; + extensions?: Extension[] | null; /** * The flag property */ - flag?: FollowupFlag; + flag?: FollowupFlag | null; /** * The from property */ - from?: Recipient; + from?: Recipient | null; /** * Indicates whether the message has attachments. This property doesn't include inline attachments, so if a message contains only inline attachments, this property is false. To verify the existence of inline attachments, parse the body property to look for a src attribute, such as . */ - hasAttachments?: boolean; + hasAttachments?: boolean | null; /** * The importance property */ - importance?: Importance; + importance?: Importance | null; /** * The inferenceClassification property */ - inferenceClassification?: InferenceClassificationType; + inferenceClassification?: InferenceClassificationType | null; /** * A collection of message headers defined by RFC5322. The set includes message headers indicating the network path taken by a message from the sender to the recipient. It can also contain custom message headers that hold app data for the message. Returned only on applying a $select query option. Read-only. */ - internetMessageHeaders?: InternetMessageHeader[]; + internetMessageHeaders?: InternetMessageHeader[] | null; /** * The message ID in the format specified by RFC2822. */ - internetMessageId?: string; + internetMessageId?: string | null; /** * Indicates whether a read receipt is requested for the message. */ - isDeliveryReceiptRequested?: boolean; + isDeliveryReceiptRequested?: boolean | null; /** * Indicates whether the message is a draft. A message is a draft if it hasn't been sent yet. */ - isDraft?: boolean; + isDraft?: boolean | null; /** * Indicates whether the message has been read. */ - isRead?: boolean; + isRead?: boolean | null; /** * Indicates whether a read receipt is requested for the message. */ - isReadReceiptRequested?: boolean; + isReadReceiptRequested?: boolean | null; /** * The collection of multi-value extended properties defined for the message. Nullable. */ - multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[]; + multiValueExtendedProperties?: MultiValueLegacyExtendedProperty[] | null; /** * The unique identifier for the message's parent mailFolder. */ - parentFolderId?: string; + parentFolderId?: string | null; /** * The date and time the message was received. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. */ - receivedDateTime?: Date; + receivedDateTime?: Date | null; /** * The email addresses to use when replying. */ - replyTo?: Recipient[]; + replyTo?: Recipient[] | null; /** * The sender property */ - sender?: Recipient; + sender?: Recipient | null; /** * The date and time the message was sent. The date and time information uses ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. */ - sentDateTime?: Date; + sentDateTime?: Date | null; /** * The collection of single-value extended properties defined for the message. Nullable. */ - singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[]; + singleValueExtendedProperties?: SingleValueLegacyExtendedProperty[] | null; /** * The subject of the message. */ - subject?: string; + subject?: string | null; /** * The To: recipients for the message. */ - toRecipients?: Recipient[]; + toRecipients?: Recipient[] | null; /** * The uniqueBody property */ - uniqueBody?: ItemBody; + uniqueBody?: ItemBody | null; /** * The URL to open the message in Outlook on the web.You can append an ispopout argument to the end of the URL to change how the message is displayed. If ispopout is not present or if it is set to 1, then the message is shown in a popout window. If ispopout is set to 0, the browser shows the message in the Outlook on the web review pane.The message opens in the browser if you are signed in to your mailbox via Outlook on the web. You are prompted to sign in if you are not already signed in with the browser.This URL cannot be accessed from within an iFrame. */ - webLink?: string; + webLink?: string | null; } export type MessageActionFlag = (typeof MessageActionFlagObject)[keyof typeof MessageActionFlagObject]; export interface MessageCollectionResponse extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The OdataNextLink property */ - odataNextLink?: string; + odataNextLink?: string | null; /** * The value property */ - value?: Message[]; + value?: Message[] | null; } export interface MessageRule extends Entity, Parsable { /** * The actions property */ - actions?: MessageRuleActions; + actions?: MessageRuleActions | null; /** * The conditions property */ - conditions?: MessageRulePredicates; + conditions?: MessageRulePredicates | null; /** * The display name of the rule. */ - displayName?: string; + displayName?: string | null; /** * The exceptions property */ - exceptions?: MessageRulePredicates; + exceptions?: MessageRulePredicates | null; /** * Indicates whether the rule is in an error condition. Read-only. */ - hasError?: boolean; + hasError?: boolean | null; /** * Indicates whether the rule is enabled to be applied to messages. */ - isEnabled?: boolean; + isEnabled?: boolean | null; /** * Indicates if the rule is read-only and cannot be modified or deleted by the rules REST API. */ - isReadOnly?: boolean; + isReadOnly?: boolean | null; /** * Indicates the order in which the rule is executed, among other rules. */ - sequence?: number; + sequence?: number | null; } export interface MessageRuleActions extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * A list of categories to be assigned to a message. */ - assignCategories?: string[]; + assignCategories?: string[] | null; /** * The ID of a folder that a message is to be copied to. */ - copyToFolder?: string; + copyToFolder?: string | null; /** * Indicates whether a message should be moved to the Deleted Items folder. */ - delete?: boolean; + delete?: boolean | null; /** * The email addresses of the recipients to which a message should be forwarded as an attachment. */ - forwardAsAttachmentTo?: Recipient[]; + forwardAsAttachmentTo?: Recipient[] | null; /** * The email addresses of the recipients to which a message should be forwarded. */ - forwardTo?: Recipient[]; + forwardTo?: Recipient[] | null; /** * Indicates whether a message should be marked as read. */ - markAsRead?: boolean; + markAsRead?: boolean | null; /** * The markImportance property */ - markImportance?: Importance; + markImportance?: Importance | null; /** * The ID of the folder that a message will be moved to. */ - moveToFolder?: string; + moveToFolder?: string | null; /** * Indicates whether a message should be permanently deleted and not saved to the Deleted Items folder. */ - permanentDelete?: boolean; + permanentDelete?: boolean | null; /** * The email addresses to which a message should be redirected. */ - redirectTo?: Recipient[]; + redirectTo?: Recipient[] | null; /** * Indicates whether subsequent rules should be evaluated. */ - stopProcessingRules?: boolean; + stopProcessingRules?: boolean | null; } export interface MessageRuleCollectionResponse extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The OdataNextLink property */ - odataNextLink?: string; + odataNextLink?: string | null; /** * The value property */ - value?: MessageRule[]; + value?: MessageRule[] | null; } export interface MessageRulePredicates extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * Represents the strings that should appear in the body of an incoming message in order for the condition or exception to apply. */ - bodyContains?: string[]; + bodyContains?: string[] | null; /** * Represents the strings that should appear in the body or subject of an incoming message in order for the condition or exception to apply. */ - bodyOrSubjectContains?: string[]; + bodyOrSubjectContains?: string[] | null; /** * Represents the categories that an incoming message should be labeled with in order for the condition or exception to apply. */ - categories?: string[]; + categories?: string[] | null; /** * Represents the specific sender email addresses of an incoming message in order for the condition or exception to apply. */ - fromAddresses?: Recipient[]; + fromAddresses?: Recipient[] | null; /** * Indicates whether an incoming message must have attachments in order for the condition or exception to apply. */ - hasAttachments?: boolean; + hasAttachments?: boolean | null; /** * Represents the strings that appear in the headers of an incoming message in order for the condition or exception to apply. */ - headerContains?: string[]; + headerContains?: string[] | null; /** * The importance property */ - importance?: Importance; + importance?: Importance | null; /** * Indicates whether an incoming message must be an approval request in order for the condition or exception to apply. */ - isApprovalRequest?: boolean; + isApprovalRequest?: boolean | null; /** * Indicates whether an incoming message must be automatically forwarded in order for the condition or exception to apply. */ - isAutomaticForward?: boolean; + isAutomaticForward?: boolean | null; /** * Indicates whether an incoming message must be an auto reply in order for the condition or exception to apply. */ - isAutomaticReply?: boolean; + isAutomaticReply?: boolean | null; /** * Indicates whether an incoming message must be encrypted in order for the condition or exception to apply. */ - isEncrypted?: boolean; + isEncrypted?: boolean | null; /** * Indicates whether an incoming message must be a meeting request in order for the condition or exception to apply. */ - isMeetingRequest?: boolean; + isMeetingRequest?: boolean | null; /** * Indicates whether an incoming message must be a meeting response in order for the condition or exception to apply. */ - isMeetingResponse?: boolean; + isMeetingResponse?: boolean | null; /** * Indicates whether an incoming message must be a non-delivery report in order for the condition or exception to apply. */ - isNonDeliveryReport?: boolean; + isNonDeliveryReport?: boolean | null; /** * Indicates whether an incoming message must be permission controlled (RMS-protected) in order for the condition or exception to apply. */ - isPermissionControlled?: boolean; + isPermissionControlled?: boolean | null; /** * Indicates whether an incoming message must be a read receipt in order for the condition or exception to apply. */ - isReadReceipt?: boolean; + isReadReceipt?: boolean | null; /** * Indicates whether an incoming message must be S/MIME-signed in order for the condition or exception to apply. */ - isSigned?: boolean; + isSigned?: boolean | null; /** * Indicates whether an incoming message must be a voice mail in order for the condition or exception to apply. */ - isVoicemail?: boolean; + isVoicemail?: boolean | null; /** * The messageActionFlag property */ - messageActionFlag?: MessageActionFlag; + messageActionFlag?: MessageActionFlag | null; /** * Indicates whether the owner of the mailbox must not be a recipient of an incoming message in order for the condition or exception to apply. */ - notSentToMe?: boolean; + notSentToMe?: boolean | null; /** * Represents the strings that appear in either the toRecipients or ccRecipients properties of an incoming message in order for the condition or exception to apply. */ - recipientContains?: string[]; + recipientContains?: string[] | null; /** * Represents the strings that appear in the from property of an incoming message in order for the condition or exception to apply. */ - senderContains?: string[]; + senderContains?: string[] | null; /** * The sensitivity property */ - sensitivity?: Sensitivity; + sensitivity?: Sensitivity | null; /** * Indicates whether the owner of the mailbox must be in the ccRecipients property of an incoming message in order for the condition or exception to apply. */ - sentCcMe?: boolean; + sentCcMe?: boolean | null; /** * Indicates whether the owner of the mailbox must be the only recipient in an incoming message in order for the condition or exception to apply. */ - sentOnlyToMe?: boolean; + sentOnlyToMe?: boolean | null; /** * Represents the email addresses that an incoming message must have been sent to in order for the condition or exception to apply. */ - sentToAddresses?: Recipient[]; + sentToAddresses?: Recipient[] | null; /** * Indicates whether the owner of the mailbox must be in the toRecipients property of an incoming message in order for the condition or exception to apply. */ - sentToMe?: boolean; + sentToMe?: boolean | null; /** * Indicates whether the owner of the mailbox must be in either a toRecipients or ccRecipients property of an incoming message in order for the condition or exception to apply. */ - sentToOrCcMe?: boolean; + sentToOrCcMe?: boolean | null; /** * Represents the strings that appear in the subject of an incoming message in order for the condition or exception to apply. */ - subjectContains?: string[]; + subjectContains?: string[] | null; /** * The withinSizeRange property */ - withinSizeRange?: SizeRange; + withinSizeRange?: SizeRange | null; } export interface MultiValueLegacyExtendedProperty extends Entity, Parsable { /** * A collection of property values. */ - value?: string[]; + value?: string[] | null; } export interface OutlookItem extends Entity, Parsable { /** * The categories associated with the item */ - categories?: string[]; + categories?: string[] | null; /** * Identifies the version of the item. Every time the item is changed, changeKey changes as well. This allows Exchange to apply changes to the correct version of the object. Read-only. */ - changeKey?: string; + changeKey?: string | null; /** * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z */ - createdDateTime?: Date; + createdDateTime?: Date | null; /** * The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z */ - lastModifiedDateTime?: Date; + lastModifiedDateTime?: Date | null; } export interface Recipient extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The emailAddress property */ - emailAddress?: EmailAddress; + emailAddress?: EmailAddress | null; } export type Sensitivity = (typeof SensitivityObject)[keyof typeof SensitivityObject]; /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeAttachment(writer: SerializationWriter, attachment: Partial | undefined = {}) : void { serializeEntity(writer, attachment) writer.writeStringValue("contentType", attachment.contentType); @@ -1208,6 +1261,7 @@ export function serializeAttachment(writer: SerializationWriter, attachment: Par * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeAttachmentCollectionResponse(writer: SerializationWriter, attachmentCollectionResponse: Partial | undefined = {}) : void { writer.writeStringValue("@odata.nextLink", attachmentCollectionResponse.odataNextLink); writer.writeCollectionOfObjectValues("value", attachmentCollectionResponse.value, serializeAttachment); @@ -1217,6 +1271,7 @@ export function serializeAttachmentCollectionResponse(writer: SerializationWrite * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeDateTimeTimeZone(writer: SerializationWriter, dateTimeTimeZone: Partial | undefined = {}) : void { writer.writeStringValue("dateTime", dateTimeTimeZone.dateTime); writer.writeStringValue("timeZone", dateTimeTimeZone.timeZone); @@ -1226,6 +1281,7 @@ export function serializeDateTimeTimeZone(writer: SerializationWriter, dateTimeT * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeEmailAddress(writer: SerializationWriter, emailAddress: Partial | undefined = {}) : void { writer.writeStringValue("address", emailAddress.address); writer.writeStringValue("name", emailAddress.name); @@ -1235,6 +1291,7 @@ export function serializeEmailAddress(writer: SerializationWriter, emailAddress: * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeEntity(writer: SerializationWriter, entity: Partial | undefined = {}) : void { writer.writeStringValue("id", entity.id); writer.writeAdditionalData(entity.additionalData); @@ -1243,6 +1300,7 @@ export function serializeEntity(writer: SerializationWriter, entity: Partial | undefined = {}) : void { serializeEntity(writer, extension) } @@ -1250,6 +1308,7 @@ export function serializeExtension(writer: SerializationWriter, extension: Parti * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeExtensionCollectionResponse(writer: SerializationWriter, extensionCollectionResponse: Partial | undefined = {}) : void { writer.writeStringValue("@odata.nextLink", extensionCollectionResponse.odataNextLink); writer.writeCollectionOfObjectValues("value", extensionCollectionResponse.value, serializeExtension); @@ -1259,6 +1318,7 @@ export function serializeExtensionCollectionResponse(writer: SerializationWriter * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeFollowupFlag(writer: SerializationWriter, followupFlag: Partial | undefined = {}) : void { writer.writeObjectValue("completedDateTime", followupFlag.completedDateTime, serializeDateTimeTimeZone); writer.writeObjectValue("dueDateTime", followupFlag.dueDateTime, serializeDateTimeTimeZone); @@ -1270,6 +1330,7 @@ export function serializeFollowupFlag(writer: SerializationWriter, followupFlag: * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeInferenceClassification(writer: SerializationWriter, inferenceClassification: Partial | undefined = {}) : void { serializeEntity(writer, inferenceClassification) writer.writeCollectionOfObjectValues("overrides", inferenceClassification.overrides, serializeInferenceClassificationOverride); @@ -1278,6 +1339,7 @@ export function serializeInferenceClassification(writer: SerializationWriter, in * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeInferenceClassificationOverride(writer: SerializationWriter, inferenceClassificationOverride: Partial | undefined = {}) : void { serializeEntity(writer, inferenceClassificationOverride) writer.writeEnumValue("classifyAs", inferenceClassificationOverride.classifyAs); @@ -1287,6 +1349,7 @@ export function serializeInferenceClassificationOverride(writer: SerializationWr * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeInferenceClassificationOverrideCollectionResponse(writer: SerializationWriter, inferenceClassificationOverrideCollectionResponse: Partial | undefined = {}) : void { writer.writeStringValue("@odata.nextLink", inferenceClassificationOverrideCollectionResponse.odataNextLink); writer.writeCollectionOfObjectValues("value", inferenceClassificationOverrideCollectionResponse.value, serializeInferenceClassificationOverride); @@ -1296,6 +1359,7 @@ export function serializeInferenceClassificationOverrideCollectionResponse(write * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeInternetMessageHeader(writer: SerializationWriter, internetMessageHeader: Partial | undefined = {}) : void { writer.writeStringValue("name", internetMessageHeader.name); writer.writeStringValue("value", internetMessageHeader.value); @@ -1305,6 +1369,7 @@ export function serializeInternetMessageHeader(writer: SerializationWriter, inte * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeItemBody(writer: SerializationWriter, itemBody: Partial | undefined = {}) : void { writer.writeStringValue("content", itemBody.content); writer.writeEnumValue("contentType", itemBody.contentType); @@ -1314,6 +1379,7 @@ export function serializeItemBody(writer: SerializationWriter, itemBody: Partial * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMailFolder(writer: SerializationWriter, mailFolder: Partial | undefined = {}) : void { serializeEntity(writer, mailFolder) writer.writeNumberValue("childFolderCount", mailFolder.childFolderCount); @@ -1332,6 +1398,7 @@ export function serializeMailFolder(writer: SerializationWriter, mailFolder: Par * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMailFolderCollectionResponse(writer: SerializationWriter, mailFolderCollectionResponse: Partial | undefined = {}) : void { writer.writeStringValue("@odata.nextLink", mailFolderCollectionResponse.odataNextLink); writer.writeCollectionOfObjectValues("value", mailFolderCollectionResponse.value, serializeMailFolder); @@ -1341,6 +1408,7 @@ export function serializeMailFolderCollectionResponse(writer: SerializationWrite * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMessage(writer: SerializationWriter, message: Partial | undefined = {}) : void { serializeOutlookItem(writer, message) writer.writeCollectionOfObjectValues("attachments", message.attachments, serializeAttachment); @@ -1378,6 +1446,7 @@ export function serializeMessage(writer: SerializationWriter, message: Partial | undefined = {}) : void { writer.writeStringValue("@odata.nextLink", messageCollectionResponse.odataNextLink); writer.writeCollectionOfObjectValues("value", messageCollectionResponse.value, serializeMessage); @@ -1387,6 +1456,7 @@ export function serializeMessageCollectionResponse(writer: SerializationWriter, * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMessageRule(writer: SerializationWriter, messageRule: Partial | undefined = {}) : void { serializeEntity(writer, messageRule) writer.writeObjectValue("actions", messageRule.actions, serializeMessageRuleActions); @@ -1402,6 +1472,7 @@ export function serializeMessageRule(writer: SerializationWriter, messageRule: P * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMessageRuleActions(writer: SerializationWriter, messageRuleActions: Partial | undefined = {}) : void { writer.writeCollectionOfPrimitiveValues("assignCategories", messageRuleActions.assignCategories); writer.writeStringValue("copyToFolder", messageRuleActions.copyToFolder); @@ -1420,6 +1491,7 @@ export function serializeMessageRuleActions(writer: SerializationWriter, message * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMessageRuleCollectionResponse(writer: SerializationWriter, messageRuleCollectionResponse: Partial | undefined = {}) : void { writer.writeStringValue("@odata.nextLink", messageRuleCollectionResponse.odataNextLink); writer.writeCollectionOfObjectValues("value", messageRuleCollectionResponse.value, serializeMessageRule); @@ -1429,6 +1501,7 @@ export function serializeMessageRuleCollectionResponse(writer: SerializationWrit * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMessageRulePredicates(writer: SerializationWriter, messageRulePredicates: Partial | undefined = {}) : void { writer.writeCollectionOfPrimitiveValues("bodyContains", messageRulePredicates.bodyContains); writer.writeCollectionOfPrimitiveValues("bodyOrSubjectContains", messageRulePredicates.bodyOrSubjectContains); @@ -1466,6 +1539,7 @@ export function serializeMessageRulePredicates(writer: SerializationWriter, mess * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMultiValueLegacyExtendedProperty(writer: SerializationWriter, multiValueLegacyExtendedProperty: Partial | undefined = {}) : void { serializeEntity(writer, multiValueLegacyExtendedProperty) writer.writeCollectionOfPrimitiveValues("value", multiValueLegacyExtendedProperty.value); @@ -1474,6 +1548,7 @@ export function serializeMultiValueLegacyExtendedProperty(writer: SerializationW * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeOutlookItem(writer: SerializationWriter, outlookItem: Partial | undefined = {}) : void { serializeEntity(writer, outlookItem) writer.writeCollectionOfPrimitiveValues("categories", outlookItem.categories); @@ -1485,6 +1560,7 @@ export function serializeOutlookItem(writer: SerializationWriter, outlookItem: P * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeRecipient(writer: SerializationWriter, recipient: Partial | undefined = {}) : void { writer.writeObjectValue("emailAddress", recipient.emailAddress, serializeEmailAddress); writer.writeAdditionalData(recipient.additionalData); @@ -1493,6 +1569,7 @@ export function serializeRecipient(writer: SerializationWriter, recipient: Parti * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeSingleValueLegacyExtendedProperty(writer: SerializationWriter, singleValueLegacyExtendedProperty: Partial | undefined = {}) : void { serializeEntity(writer, singleValueLegacyExtendedProperty) writer.writeStringValue("value", singleValueLegacyExtendedProperty.value); @@ -1501,6 +1578,7 @@ export function serializeSingleValueLegacyExtendedProperty(writer: Serialization * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeSizeRange(writer: SerializationWriter, sizeRange: Partial | undefined = {}) : void { writer.writeNumberValue("maximumSize", sizeRange.maximumSize); writer.writeNumberValue("minimumSize", sizeRange.minimumSize); @@ -1510,21 +1588,21 @@ export interface SingleValueLegacyExtendedProperty extends Entity, Parsable { /** * A property value. */ - value?: string; + value?: string | null; } export interface SizeRange extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The maximum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. */ - maximumSize?: number; + maximumSize?: number | null; /** * The minimum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. */ - minimumSize?: number; + minimumSize?: number | null; } export const BodyTypeObject = { Text: "text", diff --git a/packages/test/generatedCode/models/oDataErrors/index.ts b/packages/test/generatedCode/models/oDataErrors/index.ts index 803c30dbb..e39d52c34 100644 --- a/packages/test/generatedCode/models/oDataErrors/index.ts +++ b/packages/test/generatedCode/models/oDataErrors/index.ts @@ -9,6 +9,7 @@ import { type AdditionalDataHolder, type ApiError, type Parsable, type ParseNode * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ErrorDetails} */ +// @ts-ignore export function createErrorDetailsFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoErrorDetails; } @@ -17,6 +18,7 @@ export function createErrorDetailsFromDiscriminatorValue(parseNode: ParseNode | * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {InnerError} */ +// @ts-ignore export function createInnerErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoInnerError; } @@ -25,6 +27,7 @@ export function createInnerErrorFromDiscriminatorValue(parseNode: ParseNode | un * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {MainError} */ +// @ts-ignore export function createMainErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoMainError; } @@ -33,6 +36,7 @@ export function createMainErrorFromDiscriminatorValue(parseNode: ParseNode | und * @param parseNode The parse node to use to read the discriminator value and create the object * @returns {ODataError} */ +// @ts-ignore export function createODataErrorFromDiscriminatorValue(parseNode: ParseNode | undefined) : ((instance?: Parsable) => Record void>) { return deserializeIntoODataError; } @@ -40,6 +44,7 @@ export function createODataErrorFromDiscriminatorValue(parseNode: ParseNode | un * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoErrorDetails(errorDetails: Partial | undefined = {}) : Record void> { return { "code": n => { errorDetails.code = n.getStringValue(); }, @@ -51,6 +56,7 @@ export function deserializeIntoErrorDetails(errorDetails: Partial * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoInnerError(innerError: Partial | undefined = {}) : Record void> { return { } @@ -59,6 +65,7 @@ export function deserializeIntoInnerError(innerError: Partial | unde * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoMainError(mainError: Partial | undefined = {}) : Record void> { return { "code": n => { mainError.code = n.getStringValue(); }, @@ -72,6 +79,7 @@ export function deserializeIntoMainError(mainError: Partial | undefin * The deserialization information for the current model * @returns {Record void>} */ +// @ts-ignore export function deserializeIntoODataError(oDataError: Partial | undefined = {}) : Record void> { return { "error": n => { oDataError.errorEscaped = n.getObjectValue(createMainErrorFromDiscriminatorValue); oDataError.message = oDataError.errorEscaped?.message ?? ""; }, @@ -81,19 +89,19 @@ export interface ErrorDetails extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The code property */ - code?: string; + code?: string | null; /** * The message property */ - message?: string; + message?: string | null; /** * The target property */ - target?: string; + target?: string | null; } /** * The structure of this object is service-specific @@ -102,48 +110,49 @@ export interface InnerError extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; } export interface MainError extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The code property */ - code?: string; + code?: string | null; /** * The details property */ - details?: ErrorDetails[]; + details?: ErrorDetails[] | null; /** * The structure of this object is service-specific */ - innerError?: InnerError; + innerError?: InnerError | null; /** * The message property */ - message?: string; + message?: string | null; /** * The target property */ - target?: string; + target?: string | null; } export interface ODataError extends AdditionalDataHolder, ApiError, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record; + additionalData?: Record | null; /** * The error property */ - errorEscaped?: MainError; + errorEscaped?: MainError | null; } /** * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeErrorDetails(writer: SerializationWriter, errorDetails: Partial | undefined = {}) : void { writer.writeStringValue("code", errorDetails.code); writer.writeStringValue("message", errorDetails.message); @@ -154,6 +163,7 @@ export function serializeErrorDetails(writer: SerializationWriter, errorDetails: * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeInnerError(writer: SerializationWriter, innerError: Partial | undefined = {}) : void { writer.writeAdditionalData(innerError.additionalData); } @@ -161,6 +171,7 @@ export function serializeInnerError(writer: SerializationWriter, innerError: Par * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeMainError(writer: SerializationWriter, mainError: Partial | undefined = {}) : void { writer.writeStringValue("code", mainError.code); writer.writeCollectionOfObjectValues("details", mainError.details, serializeErrorDetails); @@ -173,6 +184,7 @@ export function serializeMainError(writer: SerializationWriter, mainError: Parti * Serializes information the current object * @param writer Serialization writer to use to serialize this model */ +// @ts-ignore export function serializeODataError(writer: SerializationWriter, oDataError: Partial | undefined = {}) : void { writer.writeObjectValue("error", oDataError.errorEscaped, serializeMainError); writer.writeAdditionalData(oDataError.additionalData); diff --git a/packages/test/generatedCode/users/item/inferenceClassification/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/index.ts index c4f511371..1433adea4 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/index.ts @@ -51,19 +51,24 @@ export interface InferenceClassificationRequestBuilder extends BaseRequestBuilde * Relevance classification of the user's messages based on explicit designations that override inferred relevance or importance. */ export interface InferenceClassificationRequestBuilderGetQueryParameters { + /** + * Expand related entities + */ + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. */ -export const InferenceClassificationRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification{?%24select}"; +export const InferenceClassificationRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification{?%24expand,%24select}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const InferenceClassificationRequestBuilderGetQueryParametersMapper: Record = { + "expand": "%24expand", "select": "%24select", }; /** diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts index 3a3a938af..dcd3a17c6 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts index 87ffe7d30..92f52efac 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts @@ -62,39 +62,49 @@ export interface OverridesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; + /** + * Expand related entities + */ + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const OverridesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides{?%24count,%24filter,%24orderby,%24select,%24skip,%24top}"; +export const OverridesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const OverridesRequestBuilderGetQueryParametersMapper: Record = { "count": "%24count", + "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts index 35f0b6c95..f22c8cfed 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts @@ -58,19 +58,24 @@ export interface InferenceClassificationOverrideItemRequestBuilder extends BaseR * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. */ export interface InferenceClassificationOverrideItemRequestBuilderGetQueryParameters { + /** + * Expand related entities + */ + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. */ -export const InferenceClassificationOverrideItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides/{inferenceClassificationOverride%2Did}{?%24select}"; +export const InferenceClassificationOverrideItemRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides/{inferenceClassificationOverride%2Did}{?%24expand,%24select}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const InferenceClassificationOverrideItemRequestBuilderGetQueryParametersMapper: Record = { + "expand": "%24expand", "select": "%24select", }; /** diff --git a/packages/test/generatedCode/users/item/mailFolders/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/count/index.ts index 126541b9b..4d58c5baa 100644 --- a/packages/test/generatedCode/users/item/mailFolders/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/index.ts b/packages/test/generatedCode/users/item/mailFolders/index.ts index 7f8ea65ba..d05a532af 100644 --- a/packages/test/generatedCode/users/item/mailFolders/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/index.ts @@ -62,40 +62,44 @@ export interface MailFoldersRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Include Hidden Folders */ - includeHiddenFolders?: string; + includeHiddenFolders?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const MailFoldersRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders{?%24count,%24expand,%24filter,%24orderby,%24select,%24skip,%24top,includeHiddenFolders}"; +export const MailFoldersRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top,includeHiddenFolders}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -104,6 +108,7 @@ const MailFoldersRequestBuilderGetQueryParametersMapper: Record "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts index 012241b06..e7de319a5 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts index 8b4eef708..0a26d0a8d 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts @@ -62,40 +62,44 @@ export interface ChildFoldersRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Include Hidden Folders */ - includeHiddenFolders?: string; + includeHiddenFolders?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const ChildFoldersRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders{?%24count,%24expand,%24filter,%24orderby,%24select,%24skip,%24top,includeHiddenFolders}"; +export const ChildFoldersRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top,includeHiddenFolders}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -104,6 +108,7 @@ const ChildFoldersRequestBuilderGetQueryParametersMapper: Record "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts index aa4abfb68..7a6c91c86 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts @@ -73,15 +73,15 @@ export interface MailFolderItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Include Hidden Folders */ - includeHiddenFolders?: string; + includeHiddenFolders?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts index 9b2ac372e..dd92d6935 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messageRules/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messageRules/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts index f6a3202a0..26f019a9a 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts @@ -62,39 +62,49 @@ export interface MessageRulesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; + /** + * Expand related entities + */ + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const MessageRulesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messageRules{?%24count,%24filter,%24orderby,%24select,%24skip,%24top}"; +export const MessageRulesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messageRules{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageRulesRequestBuilderGetQueryParametersMapper: Record = { "count": "%24count", + "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts index af1fda283..cd3f2ca15 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts @@ -58,19 +58,24 @@ export interface MessageRuleItemRequestBuilder extends BaseRequestBuilder = { + "expand": "%24expand", "select": "%24select", }; /** diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts index bc5f924c0..7768d8966 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Search items by search phrases */ - search?: string; + search?: string | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts index 07f8c1e51..2e943889d 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts @@ -62,35 +62,35 @@ export interface MessagesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; /** * Search items by search phrases */ - search?: string; + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts index dee2c4ecb..244f92803 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/attachments/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/attachments/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts index ac4db109d..7186bddd5 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts @@ -62,28 +62,40 @@ export interface AttachmentsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; + /** + * Skip the first n items + */ + skip?: number | null; + /** + * Show only the first n items + */ + top?: number | null; } /** * Uri template for the request builder. */ -export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/attachments{?%24count,%24expand,%24filter,%24orderby,%24select}"; +export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/attachments{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -92,7 +104,10 @@ const AttachmentsRequestBuilderGetQueryParametersMapper: Record "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", + "skip": "%24skip", + "top": "%24top", }; /** * Metadata for all the navigation properties in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts index ea9a4a64a..ba0976033 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts @@ -46,11 +46,11 @@ export interface AttachmentItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts index 49d74aafa..e8d828676 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/extensions/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/extensions/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts index 3c054fdc2..ff06e6817 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts @@ -62,36 +62,40 @@ export interface ExtensionsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/extensions{?%24count,%24expand,%24filter,%24orderby,%24select,%24skip,%24top}"; +export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/extensions{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -100,6 +104,7 @@ const ExtensionsRequestBuilderGetQueryParametersMapper: Record = "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts index 926c89545..b2b84701c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts @@ -61,11 +61,11 @@ export interface ExtensionItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts index 04a20650b..92c6e7c21 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts @@ -79,11 +79,11 @@ export interface MessageItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts index 508eb9dd8..b23954125 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/value/index.ts @@ -11,14 +11,21 @@ import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type Requ */ export interface ContentRequestBuilder extends BaseRequestBuilder { /** - * Get media content for the navigation property messages from users + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {Promise} * @throws {ODataError} error when the service returns a 4XX or 5XX status code */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; + delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; /** - * Update media content for the navigation property messages in users + * The unique identifier for an entity. Read-only. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined) : Promise; + /** + * The unique identifier for an entity. Read-only. * @param body Binary request body * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {Promise} @@ -26,42 +33,42 @@ export interface ContentRequestBuilder extends BaseRequestBuilder | undefined) : Promise; /** - * Get media content for the navigation property messages from users + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {RequestInformation} */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; /** - * Update media content for the navigation property messages in users - * @param body Binary request body + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {RequestInformation} */ - toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; -} -/** - * Get media content for the navigation property messages from users - */ -export interface ContentRequestBuilderGetQueryParameters { + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; /** - * Format of the content + * The unique identifier for an entity. Read-only. + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} */ - format?: string; + toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; } /** * Uri template for the request builder. */ -export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/$value{?%24format}"; -/** - * Mapper for query parameters from symbol name to serialization name represented as a constant. - */ -const ContentRequestBuilderGetQueryParametersMapper: Record = { - "format": "%24format", -}; +export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}/messages/{message%2Did}/$value"; /** * Metadata for all the requests in the request builder. */ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { + delete: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, get: { uriTemplate: ContentRequestBuilderUriTemplate, responseBodyContentType: "application/octet-stream, application/json", @@ -70,7 +77,6 @@ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { }, adapterMethodName: "sendPrimitive", responseBodyFactory: "ArrayBuffer", - queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, }, put: { uriTemplate: ContentRequestBuilderUriTemplate, diff --git a/packages/test/generatedCode/users/item/mailFolders/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/index.ts index 4ae3c568e..7501cbcc5 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/index.ts @@ -79,15 +79,15 @@ export interface MailFolderItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Include Hidden Folders */ - includeHiddenFolders?: string; + includeHiddenFolders?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts index 7342e944d..7ba2196a6 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messageRules/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messageRules/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts index 52a50d1bb..c9782b39c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts @@ -62,39 +62,49 @@ export interface MessageRulesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; + /** + * Expand related entities + */ + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const MessageRulesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messageRules{?%24count,%24filter,%24orderby,%24select,%24skip,%24top}"; +export const MessageRulesRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messageRules{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const MessageRulesRequestBuilderGetQueryParametersMapper: Record = { "count": "%24count", + "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts index 5ef304bbd..b7fdb0e06 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts @@ -58,19 +58,24 @@ export interface MessageRuleItemRequestBuilder extends BaseRequestBuilder = { + "expand": "%24expand", "select": "%24select", }; /** diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts index d4cc8b14c..b3ebff36e 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Search items by search phrases */ - search?: string; + search?: string | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts index 9095f3e4c..f7053f458 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts @@ -62,35 +62,35 @@ export interface MessagesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; /** * Search items by search phrases */ - search?: string; + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts index 808335c47..03c168516 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/attachments/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/attachments/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts index 158dfc3bc..c97b8430b 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts @@ -62,28 +62,40 @@ export interface AttachmentsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; + /** + * Skip the first n items + */ + skip?: number | null; + /** + * Show only the first n items + */ + top?: number | null; } /** * Uri template for the request builder. */ -export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/attachments{?%24count,%24expand,%24filter,%24orderby,%24select}"; +export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/attachments{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -92,7 +104,10 @@ const AttachmentsRequestBuilderGetQueryParametersMapper: Record "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", + "skip": "%24skip", + "top": "%24top", }; /** * Metadata for all the navigation properties in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts index 7126cd31f..5bd340a26 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts @@ -46,11 +46,11 @@ export interface AttachmentItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts index f6873f0f7..58faa582b 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/extensions/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/extensions/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts index 3b7c37fcf..1810fc75e 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts @@ -62,36 +62,40 @@ export interface ExtensionsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/extensions{?%24count,%24expand,%24filter,%24orderby,%24select,%24skip,%24top}"; +export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/extensions{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -100,6 +104,7 @@ const ExtensionsRequestBuilderGetQueryParametersMapper: Record = "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts index 81d2a4743..9160f2894 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts @@ -61,11 +61,11 @@ export interface ExtensionItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts index 951fd0ad7..65a6eaed9 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts @@ -79,11 +79,11 @@ export interface MessageItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts index 29fe16b6d..5bfdb7bf8 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/index.ts @@ -11,14 +11,21 @@ import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type Requ */ export interface ContentRequestBuilder extends BaseRequestBuilder { /** - * Get media content for the navigation property messages from users + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {Promise} * @throws {ODataError} error when the service returns a 4XX or 5XX status code */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; + delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; /** - * Update media content for the navigation property messages in users + * The unique identifier for an entity. Read-only. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined) : Promise; + /** + * The unique identifier for an entity. Read-only. * @param body Binary request body * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {Promise} @@ -26,42 +33,42 @@ export interface ContentRequestBuilder extends BaseRequestBuilder | undefined) : Promise; /** - * Get media content for the navigation property messages from users + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {RequestInformation} */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; /** - * Update media content for the navigation property messages in users - * @param body Binary request body + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {RequestInformation} */ - toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; -} -/** - * Get media content for the navigation property messages from users - */ -export interface ContentRequestBuilderGetQueryParameters { + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; /** - * Format of the content + * The unique identifier for an entity. Read-only. + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} */ - format?: string; + toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; } /** * Uri template for the request builder. */ -export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/$value{?%24format}"; -/** - * Mapper for query parameters from symbol name to serialization name represented as a constant. - */ -const ContentRequestBuilderGetQueryParametersMapper: Record = { - "format": "%24format", -}; +export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/$value"; /** * Metadata for all the requests in the request builder. */ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { + delete: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, get: { uriTemplate: ContentRequestBuilderUriTemplate, responseBodyContentType: "application/octet-stream, application/json", @@ -70,7 +77,6 @@ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { }, adapterMethodName: "sendPrimitive", responseBodyFactory: "ArrayBuffer", - queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, }, put: { uriTemplate: ContentRequestBuilderUriTemplate, diff --git a/packages/test/generatedCode/users/item/messages/count/index.ts b/packages/test/generatedCode/users/item/messages/count/index.ts index 932ac172b..e528357d0 100644 --- a/packages/test/generatedCode/users/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Search items by search phrases */ - search?: string; + search?: string | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/index.ts b/packages/test/generatedCode/users/item/messages/index.ts index 8066d3108..23dafb381 100644 --- a/packages/test/generatedCode/users/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/messages/index.ts @@ -62,39 +62,39 @@ export interface MessagesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Include Hidden Messages */ - includeHiddenMessages?: string; + includeHiddenMessages?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; /** * Search items by search phrases */ - search?: string; + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts index 29a969ebb..ce56c80fa 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/attachments/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/attachments/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/index.ts index e41b9382f..f1fa70f99 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/index.ts @@ -62,28 +62,40 @@ export interface AttachmentsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; + /** + * Skip the first n items + */ + skip?: number | null; + /** + * Show only the first n items + */ + top?: number | null; } /** * Uri template for the request builder. */ -export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/attachments{?%24count,%24expand,%24filter,%24orderby,%24select}"; +export const AttachmentsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/attachments{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -92,7 +104,10 @@ const AttachmentsRequestBuilderGetQueryParametersMapper: Record "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", + "skip": "%24skip", + "top": "%24top", }; /** * Metadata for all the navigation properties in the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts index f7edf9eb3..b5ad561c6 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts @@ -46,11 +46,11 @@ export interface AttachmentItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts index 043ab37c5..5671acf90 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts @@ -31,17 +31,22 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string; + filter?: string | null; + /** + * Search items by search phrases + */ + search?: string | null; } /** * Uri template for the request builder. */ -export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/extensions/$count{?%24filter}"; +export const CountRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/extensions/$count{?%24filter,%24search}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ const CountRequestBuilderGetQueryParametersMapper: Record = { "filter": "%24filter", + "search": "%24search", }; /** * Metadata for all the requests in the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/index.ts index 82506468c..e11b8523f 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/index.ts @@ -62,36 +62,40 @@ export interface ExtensionsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean; + count?: boolean | null; /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Filter items by property values */ - filter?: string; + filter?: string | null; /** * Order items by property values */ - orderby?: string[]; + orderby?: string[] | null; + /** + * Search items by search phrases + */ + search?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; /** * Skip the first n items */ - skip?: number; + skip?: number | null; /** * Show only the first n items */ - top?: number; + top?: number | null; } /** * Uri template for the request builder. */ -export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/extensions{?%24count,%24expand,%24filter,%24orderby,%24select,%24skip,%24top}"; +export const ExtensionsRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/extensions{?%24count,%24expand,%24filter,%24orderby,%24search,%24select,%24skip,%24top}"; /** * Mapper for query parameters from symbol name to serialization name represented as a constant. */ @@ -100,6 +104,7 @@ const ExtensionsRequestBuilderGetQueryParametersMapper: Record = "expand": "%24expand", "filter": "%24filter", "orderby": "%24orderby", + "search": "%24search", "select": "%24select", "skip": "%24skip", "top": "%24top", diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts index 6556f95cb..1623ca4e4 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts @@ -61,11 +61,11 @@ export interface ExtensionItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/index.ts b/packages/test/generatedCode/users/item/messages/item/index.ts index c3614d645..2279a71ae 100644 --- a/packages/test/generatedCode/users/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/index.ts @@ -79,15 +79,15 @@ export interface MessageItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[]; + expand?: string[] | null; /** * Include Hidden Messages */ - includeHiddenMessages?: string; + includeHiddenMessages?: string | null; /** * Select properties to be returned */ - select?: string[]; + select?: string[] | null; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/value/index.ts b/packages/test/generatedCode/users/item/messages/item/value/index.ts index 3efa6b4b0..816ba4b6d 100644 --- a/packages/test/generatedCode/users/item/messages/item/value/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/value/index.ts @@ -11,14 +11,21 @@ import { type BaseRequestBuilder, type Parsable, type ParsableFactory, type Requ */ export interface ContentRequestBuilder extends BaseRequestBuilder { /** - * Get media content for the navigation property messages from users + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {Promise} * @throws {ODataError} error when the service returns a 4XX or 5XX status code */ - get(requestConfiguration?: RequestConfiguration | undefined) : Promise; + delete(requestConfiguration?: RequestConfiguration | undefined) : Promise; /** - * Update media content for the navigation property messages in users + * The unique identifier for an entity. Read-only. + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {Promise} + * @throws {ODataError} error when the service returns a 4XX or 5XX status code + */ + get(requestConfiguration?: RequestConfiguration | undefined) : Promise; + /** + * The unique identifier for an entity. Read-only. * @param body Binary request body * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {Promise} @@ -26,42 +33,42 @@ export interface ContentRequestBuilder extends BaseRequestBuilder | undefined) : Promise; /** - * Get media content for the navigation property messages from users + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {RequestInformation} */ - toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; + toDeleteRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; /** - * Update media content for the navigation property messages in users - * @param body Binary request body + * The unique identifier for an entity. Read-only. * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns {RequestInformation} */ - toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; -} -/** - * Get media content for the navigation property messages from users - */ -export interface ContentRequestBuilderGetQueryParameters { + toGetRequestInformation(requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; /** - * Format of the content + * The unique identifier for an entity. Read-only. + * @param body Binary request body + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. + * @returns {RequestInformation} */ - format?: string; + toPutRequestInformation(body: ArrayBuffer | undefined, requestConfiguration?: RequestConfiguration | undefined) : RequestInformation; } /** * Uri template for the request builder. */ -export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/$value{?%24format}"; -/** - * Mapper for query parameters from symbol name to serialization name represented as a constant. - */ -const ContentRequestBuilderGetQueryParametersMapper: Record = { - "format": "%24format", -}; +export const ContentRequestBuilderUriTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/$value"; /** * Metadata for all the requests in the request builder. */ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { + delete: { + uriTemplate: ContentRequestBuilderUriTemplate, + responseBodyContentType: "application/json", + errorMappings: { + XXX: createODataErrorFromDiscriminatorValue as ParsableFactory, + }, + adapterMethodName: "sendPrimitive", + responseBodyFactory: "ArrayBuffer", + }, get: { uriTemplate: ContentRequestBuilderUriTemplate, responseBodyContentType: "application/octet-stream, application/json", @@ -70,7 +77,6 @@ export const ContentRequestBuilderRequestsMetadata: RequestsMetadata = { }, adapterMethodName: "sendPrimitive", responseBodyFactory: "ArrayBuffer", - queryParametersMapper: ContentRequestBuilderGetQueryParametersMapper, }, put: { uriTemplate: ContentRequestBuilderUriTemplate, From 79c1c8e99ef420fa65b0be043a1ad79b2713b8f3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 13 Aug 2024 10:49:06 -0400 Subject: [PATCH 15/15] chore: updates generated client --- packages/test/generatedCode/models/index.ts | 32 +++++++++---------- .../generatedCode/models/oDataErrors/index.ts | 8 ++--- .../item/inferenceClassification/index.ts | 4 +-- .../overrides/count/index.ts | 4 +-- .../overrides/index.ts | 16 +++++----- .../overrides/item/index.ts | 4 +-- .../users/item/mailFolders/count/index.ts | 4 +-- .../users/item/mailFolders/index.ts | 18 +++++------ .../item/childFolders/count/index.ts | 4 +-- .../mailFolders/item/childFolders/index.ts | 18 +++++------ .../item/childFolders/item/index.ts | 6 ++-- .../item/messageRules/count/index.ts | 4 +-- .../childFolders/item/messageRules/index.ts | 16 +++++----- .../item/messageRules/item/index.ts | 4 +-- .../childFolders/item/messages/count/index.ts | 4 +-- .../item/childFolders/item/messages/index.ts | 16 +++++----- .../messages/item/attachments/count/index.ts | 4 +-- .../item/messages/item/attachments/index.ts | 16 +++++----- .../messages/item/attachments/item/index.ts | 4 +-- .../messages/item/extensions/count/index.ts | 4 +-- .../item/messages/item/extensions/index.ts | 16 +++++----- .../messages/item/extensions/item/index.ts | 4 +-- .../childFolders/item/messages/item/index.ts | 4 +-- .../users/item/mailFolders/item/index.ts | 6 ++-- .../item/messageRules/count/index.ts | 4 +-- .../mailFolders/item/messageRules/index.ts | 16 +++++----- .../item/messageRules/item/index.ts | 4 +-- .../mailFolders/item/messages/count/index.ts | 4 +-- .../item/mailFolders/item/messages/index.ts | 16 +++++----- .../messages/item/attachments/count/index.ts | 4 +-- .../item/messages/item/attachments/index.ts | 16 +++++----- .../messages/item/attachments/item/index.ts | 4 +-- .../messages/item/extensions/count/index.ts | 4 +-- .../item/messages/item/extensions/index.ts | 16 +++++----- .../messages/item/extensions/item/index.ts | 4 +-- .../mailFolders/item/messages/item/index.ts | 4 +-- .../users/item/messages/count/index.ts | 4 +-- .../users/item/messages/index.ts | 18 +++++------ .../messages/item/attachments/count/index.ts | 4 +-- .../item/messages/item/attachments/index.ts | 16 +++++----- .../messages/item/attachments/item/index.ts | 4 +-- .../messages/item/extensions/count/index.ts | 4 +-- .../item/messages/item/extensions/index.ts | 16 +++++----- .../messages/item/extensions/item/index.ts | 4 +-- .../users/item/messages/item/index.ts | 6 ++-- 45 files changed, 196 insertions(+), 196 deletions(-) diff --git a/packages/test/generatedCode/models/index.ts b/packages/test/generatedCode/models/index.ts index 8fa535ad6..716746817 100644 --- a/packages/test/generatedCode/models/index.ts +++ b/packages/test/generatedCode/models/index.ts @@ -30,7 +30,7 @@ export interface AttachmentCollectionResponse extends AdditionalDataHolder, Pars /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The OdataNextLink property */ @@ -279,7 +279,7 @@ export interface DateTimeTimeZone extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * A single point of time in a combined date and time representation ({date}T{time}; for example, 2017-08-29T04:00:00.0000000). */ @@ -669,7 +669,7 @@ export interface EmailAddress extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The email address of the person or entity. */ @@ -683,7 +683,7 @@ export interface Entity extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The unique identifier for an entity. Read-only. */ @@ -695,7 +695,7 @@ export interface ExtensionCollectionResponse extends AdditionalDataHolder, Parsa /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The OdataNextLink property */ @@ -709,7 +709,7 @@ export interface FollowupFlag extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The completedDateTime property */ @@ -749,7 +749,7 @@ export interface InferenceClassificationOverrideCollectionResponse extends Addit /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The OdataNextLink property */ @@ -764,7 +764,7 @@ export interface InternetMessageHeader extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * Represents the key in a key-value pair. */ @@ -778,7 +778,7 @@ export interface ItemBody extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The content of the item. */ @@ -838,7 +838,7 @@ export interface MailFolderCollectionResponse extends AdditionalDataHolder, Pars /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The OdataNextLink property */ @@ -975,7 +975,7 @@ export interface MessageCollectionResponse extends AdditionalDataHolder, Parsabl /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The OdataNextLink property */ @@ -1023,7 +1023,7 @@ export interface MessageRuleActions extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * A list of categories to be assigned to a message. */ @@ -1073,7 +1073,7 @@ export interface MessageRuleCollectionResponse extends AdditionalDataHolder, Par /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The OdataNextLink property */ @@ -1087,7 +1087,7 @@ export interface MessageRulePredicates extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * Represents the strings that should appear in the body of an incoming message in order for the condition or exception to apply. */ @@ -1237,7 +1237,7 @@ export interface Recipient extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The emailAddress property */ @@ -1594,7 +1594,7 @@ export interface SizeRange extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The maximum size (in kilobytes) that an incoming message must have in order for a condition or exception to apply. */ diff --git a/packages/test/generatedCode/models/oDataErrors/index.ts b/packages/test/generatedCode/models/oDataErrors/index.ts index e39d52c34..857ca4f98 100644 --- a/packages/test/generatedCode/models/oDataErrors/index.ts +++ b/packages/test/generatedCode/models/oDataErrors/index.ts @@ -89,7 +89,7 @@ export interface ErrorDetails extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The code property */ @@ -110,13 +110,13 @@ export interface InnerError extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; } export interface MainError extends AdditionalDataHolder, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The code property */ @@ -142,7 +142,7 @@ export interface ODataError extends AdditionalDataHolder, ApiError, Parsable { /** * Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. */ - additionalData?: Record | null; + additionalData?: Record; /** * The error property */ diff --git a/packages/test/generatedCode/users/item/inferenceClassification/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/index.ts index 1433adea4..41e16f9b1 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/index.ts @@ -54,11 +54,11 @@ export interface InferenceClassificationRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts index dcd3a17c6..8eb317926 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts index 92f52efac..bdc3d9770 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/index.ts @@ -62,35 +62,35 @@ export interface OverridesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts index f22c8cfed..0474c1c45 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/index.ts @@ -61,11 +61,11 @@ export interface InferenceClassificationOverrideItemRequestBuilderGetQueryParame /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/count/index.ts index 4d58c5baa..cf7ea58e6 100644 --- a/packages/test/generatedCode/users/item/mailFolders/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/index.ts b/packages/test/generatedCode/users/item/mailFolders/index.ts index d05a532af..d4bfd8970 100644 --- a/packages/test/generatedCode/users/item/mailFolders/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/index.ts @@ -62,39 +62,39 @@ export interface MailFoldersRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Include Hidden Folders */ - includeHiddenFolders?: string | null; + includeHiddenFolders?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts index e7de319a5..8a56057b5 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts index 0a26d0a8d..9a7a58624 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/index.ts @@ -62,39 +62,39 @@ export interface ChildFoldersRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Include Hidden Folders */ - includeHiddenFolders?: string | null; + includeHiddenFolders?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts index 7a6c91c86..aa4abfb68 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/index.ts @@ -73,15 +73,15 @@ export interface MailFolderItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Include Hidden Folders */ - includeHiddenFolders?: string | null; + includeHiddenFolders?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts index dd92d6935..23a3d1f62 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts index 26f019a9a..426380d3c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/index.ts @@ -62,35 +62,35 @@ export interface MessageRulesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts index cd3f2ca15..85e983463 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messageRules/item/index.ts @@ -61,11 +61,11 @@ export interface MessageRuleItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts index 7768d8966..bc5f924c0 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts index 2e943889d..07f8c1e51 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/index.ts @@ -62,35 +62,35 @@ export interface MessagesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts index 244f92803..cfd45147b 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts index 7186bddd5..184100ea7 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/index.ts @@ -62,35 +62,35 @@ export interface AttachmentsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts index ba0976033..ea9a4a64a 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/attachments/item/index.ts @@ -46,11 +46,11 @@ export interface AttachmentItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts index e8d828676..97a094981 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts index ff06e6817..08e573d7c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/index.ts @@ -62,35 +62,35 @@ export interface ExtensionsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts index b2b84701c..926c89545 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/extensions/item/index.ts @@ -61,11 +61,11 @@ export interface ExtensionItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts index 92c6e7c21..04a20650b 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/messages/item/index.ts @@ -79,11 +79,11 @@ export interface MessageItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/index.ts index 7501cbcc5..4ae3c568e 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/index.ts @@ -79,15 +79,15 @@ export interface MailFolderItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Include Hidden Folders */ - includeHiddenFolders?: string | null; + includeHiddenFolders?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts index 7ba2196a6..56d9651fb 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts index c9782b39c..ab363e25b 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/index.ts @@ -62,35 +62,35 @@ export interface MessageRulesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts index b7fdb0e06..cc3daac82 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/index.ts @@ -61,11 +61,11 @@ export interface MessageRuleItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts index b3ebff36e..d4cc8b14c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts index f7053f458..9095f3e4c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/index.ts @@ -62,35 +62,35 @@ export interface MessagesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts index 03c168516..2cf2bcf99 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts index c97b8430b..920ec2783 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/index.ts @@ -62,35 +62,35 @@ export interface AttachmentsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts index 5bd340a26..7126cd31f 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/index.ts @@ -46,11 +46,11 @@ export interface AttachmentItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts index 58faa582b..1a6874783 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts index 1810fc75e..278c66608 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/index.ts @@ -62,35 +62,35 @@ export interface ExtensionsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts index 9160f2894..81d2a4743 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/index.ts @@ -61,11 +61,11 @@ export interface ExtensionItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts index 65a6eaed9..951fd0ad7 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/index.ts @@ -79,11 +79,11 @@ export interface MessageItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/count/index.ts b/packages/test/generatedCode/users/item/messages/count/index.ts index e528357d0..932ac172b 100644 --- a/packages/test/generatedCode/users/item/messages/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/index.ts b/packages/test/generatedCode/users/item/messages/index.ts index 23dafb381..8066d3108 100644 --- a/packages/test/generatedCode/users/item/messages/index.ts +++ b/packages/test/generatedCode/users/item/messages/index.ts @@ -62,39 +62,39 @@ export interface MessagesRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Include Hidden Messages */ - includeHiddenMessages?: string | null; + includeHiddenMessages?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts index ce56c80fa..99cbf7f5c 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/index.ts index f1fa70f99..2db372bb3 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/index.ts @@ -62,35 +62,35 @@ export interface AttachmentsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts index b5ad561c6..f7edf9eb3 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/index.ts @@ -46,11 +46,11 @@ export interface AttachmentItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts index 5671acf90..bcecd4b3b 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/count/index.ts @@ -31,11 +31,11 @@ export interface CountRequestBuilderGetQueryParameters { /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Search items by search phrases */ - search?: string | null; + search?: string; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/index.ts index e11b8523f..d28c7bc82 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/index.ts @@ -62,35 +62,35 @@ export interface ExtensionsRequestBuilderGetQueryParameters { /** * Include count of items */ - count?: boolean | null; + count?: boolean; /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Filter items by property values */ - filter?: string | null; + filter?: string; /** * Order items by property values */ - orderby?: string[] | null; + orderby?: string[]; /** * Search items by search phrases */ - search?: string | null; + search?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; /** * Skip the first n items */ - skip?: number | null; + skip?: number; /** * Show only the first n items */ - top?: number | null; + top?: number; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts index 1623ca4e4..6556f95cb 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/index.ts @@ -61,11 +61,11 @@ export interface ExtensionItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder. diff --git a/packages/test/generatedCode/users/item/messages/item/index.ts b/packages/test/generatedCode/users/item/messages/item/index.ts index 2279a71ae..c3614d645 100644 --- a/packages/test/generatedCode/users/item/messages/item/index.ts +++ b/packages/test/generatedCode/users/item/messages/item/index.ts @@ -79,15 +79,15 @@ export interface MessageItemRequestBuilderGetQueryParameters { /** * Expand related entities */ - expand?: string[] | null; + expand?: string[]; /** * Include Hidden Messages */ - includeHiddenMessages?: string | null; + includeHiddenMessages?: string; /** * Select properties to be returned */ - select?: string[] | null; + select?: string[]; } /** * Uri template for the request builder.