diff --git a/package-versions.props b/package-versions.props
index 5edd2d7ab3..41238fcf3e 100644
--- a/package-versions.props
+++ b/package-versions.props
@@ -4,7 +4,7 @@
4.1.0
0.4.1
2.14.1
- 6.6.1
+ 6.6.2
13.0.3
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/ModelStateValidationClient.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/ModelStateValidationClient.cs
new file mode 100644
index 0000000000..bf9e33ae22
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/ModelStateValidationClient.cs
@@ -0,0 +1,48 @@
+//
+using Microsoft.Kiota.Abstractions.Extensions;
+using Microsoft.Kiota.Abstractions.Store;
+using Microsoft.Kiota.Abstractions;
+using Microsoft.Kiota.Serialization.Form;
+using Microsoft.Kiota.Serialization.Json;
+using Microsoft.Kiota.Serialization.Multipart;
+using Microsoft.Kiota.Serialization.Text;
+using OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.SocialMediaAccounts;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode {
+ ///
+ /// The main entry point of the SDK, exposes the configuration and the fluent API.
+ ///
+ public class ModelStateValidationClient : BaseRequestBuilder
+ {
+ /// The socialMediaAccounts property
+ public SocialMediaAccountsRequestBuilder SocialMediaAccounts
+ {
+ get => new SocialMediaAccountsRequestBuilder(PathParameters, RequestAdapter);
+ }
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ /// The backing store to use for the models.
+ /// The request adapter to use to execute the requests.
+ public ModelStateValidationClient(IRequestAdapter requestAdapter, IBackingStoreFactory backingStore = default) : base(requestAdapter, "{+baseurl}", new Dictionary())
+ {
+ ApiClientBuilder.RegisterDefaultSerializer();
+ ApiClientBuilder.RegisterDefaultSerializer();
+ ApiClientBuilder.RegisterDefaultSerializer();
+ ApiClientBuilder.RegisterDefaultSerializer();
+ ApiClientBuilder.RegisterDefaultDeserializer();
+ ApiClientBuilder.RegisterDefaultDeserializer();
+ ApiClientBuilder.RegisterDefaultDeserializer();
+ if (string.IsNullOrEmpty(RequestAdapter.BaseUrl))
+ {
+ RequestAdapter.BaseUrl = "http://localhost";
+ }
+ PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl);
+ RequestAdapter.EnableBackingStore(backingStore);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs
new file mode 100644
index 0000000000..932e4dc2c8
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/DataInResponse.cs
@@ -0,0 +1,88 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class DataInResponse : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The id property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Id {
+ get { return BackingStore?.Get("id"); }
+ set { BackingStore?.Set("id", value); }
+ }
+#nullable restore
+#else
+ public string Id {
+ get { return BackingStore?.Get("id"); }
+ set { BackingStore?.Set("id", value); }
+ }
+#endif
+ /// The type property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Type {
+ get { return BackingStore?.Get("type"); }
+ set { BackingStore?.Set("type", value); }
+ }
+#nullable restore
+#else
+ public string Type {
+ get { return BackingStore?.Get("type"); }
+ set { BackingStore?.Set("type", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public DataInResponse()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static DataInResponse CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ var mappingValue = parseNode.GetChildNode("type")?.GetStringValue();
+ return mappingValue switch
+ {
+ "socialMediaAccounts" => new SocialMediaAccountDataInResponse(),
+ _ => new DataInResponse(),
+ };
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"id", n => { Id = n.GetStringValue(); } },
+ {"type", n => { Type = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("id", Id);
+ writer.WriteStringValue("type", Type);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorLinks.cs
new file mode 100644
index 0000000000..3a332296fe
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorLinks.cs
@@ -0,0 +1,83 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorLinks : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// The about property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? About {
+ get { return BackingStore?.Get("about"); }
+ set { BackingStore?.Set("about", value); }
+ }
+#nullable restore
+#else
+ public string About {
+ get { return BackingStore?.Get("about"); }
+ set { BackingStore?.Set("about", value); }
+ }
+#endif
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The type property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Type {
+ get { return BackingStore?.Get("type"); }
+ set { BackingStore?.Set("type", value); }
+ }
+#nullable restore
+#else
+ public string Type {
+ get { return BackingStore?.Get("type"); }
+ set { BackingStore?.Set("type", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorLinks()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorLinks CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorLinks();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"about", n => { About = n.GetStringValue(); } },
+ {"type", n => { Type = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("about", About);
+ writer.WriteStringValue("type", Type);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject.cs
new file mode 100644
index 0000000000..16e5269395
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject.cs
@@ -0,0 +1,179 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorObject : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The code property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Code {
+ get { return BackingStore?.Get("code"); }
+ set { BackingStore?.Set("code", value); }
+ }
+#nullable restore
+#else
+ public string Code {
+ get { return BackingStore?.Get("code"); }
+ set { BackingStore?.Set("code", value); }
+ }
+#endif
+ /// The detail property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Detail {
+ get { return BackingStore?.Get("detail"); }
+ set { BackingStore?.Set("detail", value); }
+ }
+#nullable restore
+#else
+ public string Detail {
+ get { return BackingStore?.Get("detail"); }
+ set { BackingStore?.Set("detail", value); }
+ }
+#endif
+ /// The id property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Id {
+ get { return BackingStore?.Get("id"); }
+ set { BackingStore?.Set("id", value); }
+ }
+#nullable restore
+#else
+ public string Id {
+ get { return BackingStore?.Get("id"); }
+ set { BackingStore?.Set("id", value); }
+ }
+#endif
+ /// The links property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public ErrorLinks? Links {
+ get { return BackingStore?.Get("links"); }
+ set { BackingStore?.Set("links", value); }
+ }
+#nullable restore
+#else
+ public ErrorLinks Links {
+ get { return BackingStore?.Get("links"); }
+ set { BackingStore?.Set("links", value); }
+ }
+#endif
+ /// The meta property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public ErrorObject_meta? Meta {
+ get { return BackingStore?.Get("meta"); }
+ set { BackingStore?.Set("meta", value); }
+ }
+#nullable restore
+#else
+ public ErrorObject_meta Meta {
+ get { return BackingStore?.Get("meta"); }
+ set { BackingStore?.Set("meta", value); }
+ }
+#endif
+ /// The source property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public ErrorSource? Source {
+ get { return BackingStore?.Get("source"); }
+ set { BackingStore?.Set("source", value); }
+ }
+#nullable restore
+#else
+ public ErrorSource Source {
+ get { return BackingStore?.Get("source"); }
+ set { BackingStore?.Set("source", value); }
+ }
+#endif
+ /// The status property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Status {
+ get { return BackingStore?.Get("status"); }
+ set { BackingStore?.Set("status", value); }
+ }
+#nullable restore
+#else
+ public string Status {
+ get { return BackingStore?.Get("status"); }
+ set { BackingStore?.Set("status", value); }
+ }
+#endif
+ /// The title property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Title {
+ get { return BackingStore?.Get("title"); }
+ set { BackingStore?.Set("title", value); }
+ }
+#nullable restore
+#else
+ public string Title {
+ get { return BackingStore?.Get("title"); }
+ set { BackingStore?.Set("title", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorObject()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorObject CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorObject();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"code", n => { Code = n.GetStringValue(); } },
+ {"detail", n => { Detail = n.GetStringValue(); } },
+ {"id", n => { Id = n.GetStringValue(); } },
+ {"links", n => { Links = n.GetObjectValue(ErrorLinks.CreateFromDiscriminatorValue); } },
+ {"meta", n => { Meta = n.GetObjectValue(ErrorObject_meta.CreateFromDiscriminatorValue); } },
+ {"source", n => { Source = n.GetObjectValue(ErrorSource.CreateFromDiscriminatorValue); } },
+ {"status", n => { Status = n.GetStringValue(); } },
+ {"title", n => { Title = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("code", Code);
+ writer.WriteStringValue("detail", Detail);
+ writer.WriteStringValue("id", Id);
+ writer.WriteObjectValue("links", Links);
+ writer.WriteObjectValue("meta", Meta);
+ writer.WriteObjectValue("source", Source);
+ writer.WriteStringValue("status", Status);
+ writer.WriteStringValue("title", Title);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject_meta.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject_meta.cs
new file mode 100644
index 0000000000..6edceb8215
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorObject_meta.cs
@@ -0,0 +1,58 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorObject_meta : IAdditionalDataHolder, IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
+ public IDictionary AdditionalData {
+ get { return BackingStore.Get>("AdditionalData") ?? throw new InvalidOperationException("AdditionalData can not be null"); }
+ set { BackingStore.Set("AdditionalData", value); }
+ }
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorObject_meta()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ AdditionalData = new Dictionary();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorObject_meta CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorObject_meta();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteAdditionalData(AdditionalData);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument.cs
new file mode 100644
index 0000000000..dfba3e4512
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument.cs
@@ -0,0 +1,102 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using Microsoft.Kiota.Abstractions;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorResponseDocument : ApiException, IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The errors property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public List? Errors {
+ get { return BackingStore?.Get?>("errors"); }
+ set { BackingStore?.Set("errors", value); }
+ }
+#nullable restore
+#else
+ public List Errors {
+ get { return BackingStore?.Get>("errors"); }
+ set { BackingStore?.Set("errors", value); }
+ }
+#endif
+ /// The links property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public ErrorTopLevelLinks? Links {
+ get { return BackingStore?.Get("links"); }
+ set { BackingStore?.Set("links", value); }
+ }
+#nullable restore
+#else
+ public ErrorTopLevelLinks Links {
+ get { return BackingStore?.Get("links"); }
+ set { BackingStore?.Set("links", value); }
+ }
+#endif
+ /// The primary error message.
+ public override string Message { get => base.Message; }
+ /// The meta property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public ErrorResponseDocument_meta? Meta {
+ get { return BackingStore?.Get("meta"); }
+ set { BackingStore?.Set("meta", value); }
+ }
+#nullable restore
+#else
+ public ErrorResponseDocument_meta Meta {
+ get { return BackingStore?.Get("meta"); }
+ set { BackingStore?.Set("meta", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorResponseDocument()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorResponseDocument CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorResponseDocument();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"errors", n => { Errors = n.GetCollectionOfObjectValues(ErrorObject.CreateFromDiscriminatorValue)?.ToList(); } },
+ {"links", n => { Links = n.GetObjectValue(ErrorTopLevelLinks.CreateFromDiscriminatorValue); } },
+ {"meta", n => { Meta = n.GetObjectValue(ErrorResponseDocument_meta.CreateFromDiscriminatorValue); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteCollectionOfObjectValues("errors", Errors);
+ writer.WriteObjectValue("links", Links);
+ writer.WriteObjectValue("meta", Meta);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument_meta.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument_meta.cs
new file mode 100644
index 0000000000..6c77bba3df
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorResponseDocument_meta.cs
@@ -0,0 +1,58 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorResponseDocument_meta : IAdditionalDataHolder, IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
+ public IDictionary AdditionalData {
+ get { return BackingStore.Get>("AdditionalData") ?? throw new InvalidOperationException("AdditionalData can not be null"); }
+ set { BackingStore.Set("AdditionalData", value); }
+ }
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorResponseDocument_meta()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ AdditionalData = new Dictionary();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorResponseDocument_meta CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorResponseDocument_meta();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteAdditionalData(AdditionalData);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorSource.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorSource.cs
new file mode 100644
index 0000000000..8a4df7fed9
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorSource.cs
@@ -0,0 +1,99 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorSource : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The header property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Header {
+ get { return BackingStore?.Get("header"); }
+ set { BackingStore?.Set("header", value); }
+ }
+#nullable restore
+#else
+ public string Header {
+ get { return BackingStore?.Get("header"); }
+ set { BackingStore?.Set("header", value); }
+ }
+#endif
+ /// The parameter property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Parameter {
+ get { return BackingStore?.Get("parameter"); }
+ set { BackingStore?.Set("parameter", value); }
+ }
+#nullable restore
+#else
+ public string Parameter {
+ get { return BackingStore?.Get("parameter"); }
+ set { BackingStore?.Set("parameter", value); }
+ }
+#endif
+ /// The pointer property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Pointer {
+ get { return BackingStore?.Get("pointer"); }
+ set { BackingStore?.Set("pointer", value); }
+ }
+#nullable restore
+#else
+ public string Pointer {
+ get { return BackingStore?.Get("pointer"); }
+ set { BackingStore?.Set("pointer", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorSource()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorSource CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorSource();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"header", n => { Header = n.GetStringValue(); } },
+ {"parameter", n => { Parameter = n.GetStringValue(); } },
+ {"pointer", n => { Pointer = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("header", Header);
+ writer.WriteStringValue("parameter", Parameter);
+ writer.WriteStringValue("pointer", Pointer);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorTopLevelLinks.cs
new file mode 100644
index 0000000000..15ce3b1b93
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ErrorTopLevelLinks.cs
@@ -0,0 +1,83 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ErrorTopLevelLinks : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The describedby property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Describedby {
+ get { return BackingStore?.Get("describedby"); }
+ set { BackingStore?.Set("describedby", value); }
+ }
+#nullable restore
+#else
+ public string Describedby {
+ get { return BackingStore?.Get("describedby"); }
+ set { BackingStore?.Set("describedby", value); }
+ }
+#endif
+ /// The self property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Self {
+ get { return BackingStore?.Get("self"); }
+ set { BackingStore?.Set("self", value); }
+ }
+#nullable restore
+#else
+ public string Self {
+ get { return BackingStore?.Get("self"); }
+ set { BackingStore?.Set("self", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ErrorTopLevelLinks()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ErrorTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ErrorTopLevelLinks();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"describedby", n => { Describedby = n.GetStringValue(); } },
+ {"self", n => { Self = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("describedby", Describedby);
+ writer.WriteStringValue("self", Self);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceLinks.cs
new file mode 100644
index 0000000000..c9a5c80608
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceLinks.cs
@@ -0,0 +1,67 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ResourceLinks : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The self property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Self {
+ get { return BackingStore?.Get("self"); }
+ set { BackingStore?.Set("self", value); }
+ }
+#nullable restore
+#else
+ public string Self {
+ get { return BackingStore?.Get("self"); }
+ set { BackingStore?.Set("self", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ResourceLinks()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ResourceLinks CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ResourceLinks();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"self", n => { Self = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("self", Self);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceTopLevelLinks.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceTopLevelLinks.cs
new file mode 100644
index 0000000000..b13259fe7c
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/ResourceTopLevelLinks.cs
@@ -0,0 +1,83 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class ResourceTopLevelLinks : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The describedby property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Describedby {
+ get { return BackingStore?.Get("describedby"); }
+ set { BackingStore?.Set("describedby", value); }
+ }
+#nullable restore
+#else
+ public string Describedby {
+ get { return BackingStore?.Get("describedby"); }
+ set { BackingStore?.Set("describedby", value); }
+ }
+#endif
+ /// The self property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Self {
+ get { return BackingStore?.Get("self"); }
+ set { BackingStore?.Set("self", value); }
+ }
+#nullable restore
+#else
+ public string Self {
+ get { return BackingStore?.Get("self"); }
+ set { BackingStore?.Set("self", value); }
+ }
+#endif
+ ///
+ /// Instantiates a new and sets the default values.
+ ///
+ public ResourceTopLevelLinks()
+ {
+ BackingStore = BackingStoreFactorySingleton.Instance.CreateBackingStore();
+ }
+ ///
+ /// Creates a new instance of the appropriate class based on discriminator value
+ ///
+ /// A
+ /// The parse node to use to read the discriminator value and create the object
+ public static ResourceTopLevelLinks CreateFromDiscriminatorValue(IParseNode parseNode)
+ {
+ _ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
+ return new ResourceTopLevelLinks();
+ }
+ ///
+ /// The deserialization information for the current model
+ ///
+ /// A IDictionary<string, Action<IParseNode>>
+ public virtual IDictionary> GetFieldDeserializers()
+ {
+ return new Dictionary>
+ {
+ {"describedby", n => { Describedby = n.GetStringValue(); } },
+ {"self", n => { Self = n.GetStringValue(); } },
+ };
+ }
+ ///
+ /// Serializes information the current object
+ ///
+ /// Serialization writer to use to serialize this model
+ public virtual void Serialize(ISerializationWriter writer)
+ {
+ _ = writer ?? throw new ArgumentNullException(nameof(writer));
+ writer.WriteStringValue("describedby", Describedby);
+ writer.WriteStringValue("self", Self);
+ }
+ }
+}
diff --git a/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInPatchRequest.cs b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInPatchRequest.cs
new file mode 100644
index 0000000000..75688fb5f1
--- /dev/null
+++ b/test/OpenApiKiotaEndToEndTests/ModelStateValidation/GeneratedCode/Models/SocialMediaAccountAttributesInPatchRequest.cs
@@ -0,0 +1,295 @@
+//
+using Microsoft.Kiota.Abstractions.Serialization;
+using Microsoft.Kiota.Abstractions.Store;
+using Microsoft.Kiota.Abstractions;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System;
+namespace OpenApiKiotaEndToEndTests.ModelStateValidation.GeneratedCode.Models {
+ #pragma warning disable CS1591
+ public class SocialMediaAccountAttributesInPatchRequest : IBackedModel, IParsable
+ #pragma warning restore CS1591
+ {
+ /// The age property
+ public double? Age {
+ get { return BackingStore?.Get("age"); }
+ set { BackingStore?.Set("age", value); }
+ }
+ /// The alternativeId property
+ public Guid? AlternativeId {
+ get { return BackingStore?.Get("alternativeId"); }
+ set { BackingStore?.Set("alternativeId", value); }
+ }
+ /// The backgroundPicture property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? BackgroundPicture {
+ get { return BackingStore?.Get("backgroundPicture"); }
+ set { BackingStore?.Set("backgroundPicture", value); }
+ }
+#nullable restore
+#else
+ public string BackgroundPicture {
+ get { return BackingStore?.Get("backgroundPicture"); }
+ set { BackingStore?.Set("backgroundPicture", value); }
+ }
+#endif
+ /// Stores model information.
+ public IBackingStore BackingStore { get; private set; }
+ /// The countryCode property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? CountryCode {
+ get { return BackingStore?.Get("countryCode"); }
+ set { BackingStore?.Set("countryCode", value); }
+ }
+#nullable restore
+#else
+ public string CountryCode {
+ get { return BackingStore?.Get("countryCode"); }
+ set { BackingStore?.Set("countryCode", value); }
+ }
+#endif
+ /// The creditCard property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? CreditCard {
+ get { return BackingStore?.Get("creditCard"); }
+ set { BackingStore?.Set("creditCard", value); }
+ }
+#nullable restore
+#else
+ public string CreditCard {
+ get { return BackingStore?.Get("creditCard"); }
+ set { BackingStore?.Set("creditCard", value); }
+ }
+#endif
+ /// The email property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Email {
+ get { return BackingStore?.Get("email"); }
+ set { BackingStore?.Set("email", value); }
+ }
+#nullable restore
+#else
+ public string Email {
+ get { return BackingStore?.Get("email"); }
+ set { BackingStore?.Set("email", value); }
+ }
+#endif
+ /// The firstName property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? FirstName {
+ get { return BackingStore?.Get("firstName"); }
+ set { BackingStore?.Set("firstName", value); }
+ }
+#nullable restore
+#else
+ public string FirstName {
+ get { return BackingStore?.Get("firstName"); }
+ set { BackingStore?.Set("firstName", value); }
+ }
+#endif
+ /// The lastName property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? LastName {
+ get { return BackingStore?.Get("lastName"); }
+ set { BackingStore?.Set("lastName", value); }
+ }
+#nullable restore
+#else
+ public string LastName {
+ get { return BackingStore?.Get("lastName"); }
+ set { BackingStore?.Set("lastName", value); }
+ }
+#endif
+ /// The nextRevalidation property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? NextRevalidation {
+ get { return BackingStore?.Get("nextRevalidation"); }
+ set { BackingStore?.Set("nextRevalidation", value); }
+ }
+#nullable restore
+#else
+ public string NextRevalidation {
+ get { return BackingStore?.Get("nextRevalidation"); }
+ set { BackingStore?.Set("nextRevalidation", value); }
+ }
+#endif
+ /// The password property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Password {
+ get { return BackingStore?.Get("password"); }
+ set { BackingStore?.Set("password", value); }
+ }
+#nullable restore
+#else
+ public string Password {
+ get { return BackingStore?.Get("password"); }
+ set { BackingStore?.Set("password", value); }
+ }
+#endif
+ /// The phone property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Phone {
+ get { return BackingStore?.Get("phone"); }
+ set { BackingStore?.Set("phone", value); }
+ }
+#nullable restore
+#else
+ public string Phone {
+ get { return BackingStore?.Get("phone"); }
+ set { BackingStore?.Set("phone", value); }
+ }
+#endif
+ /// The planet property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? Planet {
+ get { return BackingStore?.Get("planet"); }
+ set { BackingStore?.Set("planet", value); }
+ }
+#nullable restore
+#else
+ public string Planet {
+ get { return BackingStore?.Get("planet"); }
+ set { BackingStore?.Set("planet", value); }
+ }
+#endif
+ /// The profilePicture property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? ProfilePicture {
+ get { return BackingStore?.Get("profilePicture"); }
+ set { BackingStore?.Set("profilePicture", value); }
+ }
+#nullable restore
+#else
+ public string ProfilePicture {
+ get { return BackingStore?.Get("profilePicture"); }
+ set { BackingStore?.Set("profilePicture", value); }
+ }
+#endif
+ /// The tags property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public List? Tags {
+ get { return BackingStore?.Get?>("tags"); }
+ set { BackingStore?.Set("tags", value); }
+ }
+#nullable restore
+#else
+ public List Tags {
+ get { return BackingStore?.Get>("tags"); }
+ set { BackingStore?.Set("tags", value); }
+ }
+#endif
+ /// The userName property
+#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
+#nullable enable
+ public string? UserName {
+ get { return BackingStore?.Get("userName"); }
+ set { BackingStore?.Set("userName", value); }
+ }
+#nullable restore
+#else
+ public string UserName {
+ get { return BackingStore?.Get("userName"); }
+ set { BackingStore?.Set("userName", value); }
+ }
+#endif
+ /// The validatedAt property
+ public DateTimeOffset? ValidatedAt {
+ get { return BackingStore?.Get("validatedAt"); }
+ set { BackingStore?.Set("validatedAt", value); }
+ }
+ /// The validatedAtDate property
+ public Date? ValidatedAtDate {
+ get { return BackingStore?.Get("validatedAtDate"); }
+ set { BackingStore?.Set("validatedAtDate", value); }
+ }
+ /// The validatedAtTime property
+ public Time? ValidatedAtTime {
+ get { return BackingStore?.Get