Skip to content

Commit

Permalink
Merge pull request #542 from microsoft/feature/error-and-discriminato…
Browse files Browse the repository at this point in the history
…r-update

- code-gen: updates for errors and discriminator
  • Loading branch information
baywet authored Mar 2, 2022
2 parents e727600 + a37762d commit 63f3aec
Show file tree
Hide file tree
Showing 365 changed files with 7,141 additions and 5,401 deletions.
8 changes: 8 additions & 0 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/Attachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ public class Attachment : Entity, IParsable {
/// <summary>The length of the attachment in bytes.</summary>
public int? Size { get; set; }
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static new Attachment CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new Attachment();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public new IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public DateTimeTimeZone() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static DateTimeTimeZone CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new DateTimeTimeZone();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
Expand Down
8 changes: 8 additions & 0 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/EmailAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public EmailAddress() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static EmailAddress CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new EmailAddress();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
Expand Down
8 changes: 8 additions & 0 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ public Entity() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static Entity CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new Entity();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
Expand Down
8 changes: 8 additions & 0 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
using System.Linq;
namespace Graphdotnetv4.Models.Microsoft.Graph {
public class Extension : Entity, IParsable {
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static new Extension CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new Extension();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
Expand Down
14 changes: 11 additions & 3 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/FollowupFlag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ public FollowupFlag() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static FollowupFlag CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new FollowupFlag();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>> {
{"completedDateTime", (o,n) => { (o as FollowupFlag).CompletedDateTime = n.GetObjectValue<DateTimeTimeZone>(); } },
{"dueDateTime", (o,n) => { (o as FollowupFlag).DueDateTime = n.GetObjectValue<DateTimeTimeZone>(); } },
{"completedDateTime", (o,n) => { (o as FollowupFlag).CompletedDateTime = n.GetObjectValue<DateTimeTimeZone>(DateTimeTimeZone.CreateFromDiscriminatorValue); } },
{"dueDateTime", (o,n) => { (o as FollowupFlag).DueDateTime = n.GetObjectValue<DateTimeTimeZone>(DateTimeTimeZone.CreateFromDiscriminatorValue); } },
{"flagStatus", (o,n) => { (o as FollowupFlag).FlagStatus = n.GetEnumValue<FollowupFlagStatus>(); } },
{"startDateTime", (o,n) => { (o as FollowupFlag).StartDateTime = n.GetObjectValue<DateTimeTimeZone>(); } },
{"startDateTime", (o,n) => { (o as FollowupFlag).StartDateTime = n.GetObjectValue<DateTimeTimeZone>(DateTimeTimeZone.CreateFromDiscriminatorValue); } },
};
}
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ public class InferenceClassification : Entity, IParsable {
/// <summary>A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable.</summary>
public List<InferenceClassificationOverride> Overrides { get; set; }
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static new InferenceClassification CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new InferenceClassification();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public new IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>>(base.GetFieldDeserializers<T>()) {
{"overrides", (o,n) => { (o as InferenceClassification).Overrides = n.GetCollectionOfObjectValues<InferenceClassificationOverride>().ToList(); } },
{"overrides", (o,n) => { (o as InferenceClassification).Overrides = n.GetCollectionOfObjectValues<InferenceClassificationOverride>(InferenceClassificationOverride.CreateFromDiscriminatorValue).ToList(); } },
};
}
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ public class InferenceClassificationOverride : Entity, IParsable {
public InferenceClassificationType? ClassifyAs { get; set; }
public EmailAddress SenderEmailAddress { get; set; }
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static new InferenceClassificationOverride CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new InferenceClassificationOverride();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public new IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>>(base.GetFieldDeserializers<T>()) {
{"classifyAs", (o,n) => { (o as InferenceClassificationOverride).ClassifyAs = n.GetEnumValue<InferenceClassificationType>(); } },
{"senderEmailAddress", (o,n) => { (o as InferenceClassificationOverride).SenderEmailAddress = n.GetObjectValue<EmailAddress>(); } },
{"senderEmailAddress", (o,n) => { (o as InferenceClassificationOverride).SenderEmailAddress = n.GetObjectValue<EmailAddress>(EmailAddress.CreateFromDiscriminatorValue); } },
};
}
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public InternetMessageHeader() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static InternetMessageHeader CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new InternetMessageHeader();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
Expand Down
8 changes: 8 additions & 0 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/ItemBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public ItemBody() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static ItemBody CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new ItemBody();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
Expand Down
18 changes: 13 additions & 5 deletions msgraph-mail/dotnet/Models/Microsoft/Graph/MailFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,27 @@ public class MailFolder : Entity, IParsable {
/// <summary>The number of items in the mailFolder marked as unread.</summary>
public int? UnreadItemCount { get; set; }
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static new MailFolder CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new MailFolder();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public new IDictionary<string, Action<T, IParseNode>> GetFieldDeserializers<T>() {
return new Dictionary<string, Action<T, IParseNode>>(base.GetFieldDeserializers<T>()) {
{"childFolderCount", (o,n) => { (o as MailFolder).ChildFolderCount = n.GetIntValue(); } },
{"childFolders", (o,n) => { (o as MailFolder).ChildFolders = n.GetCollectionOfObjectValues<MailFolder>().ToList(); } },
{"childFolders", (o,n) => { (o as MailFolder).ChildFolders = n.GetCollectionOfObjectValues<MailFolder>(MailFolder.CreateFromDiscriminatorValue).ToList(); } },
{"displayName", (o,n) => { (o as MailFolder).DisplayName = n.GetStringValue(); } },
{"isHidden", (o,n) => { (o as MailFolder).IsHidden = n.GetBoolValue(); } },
{"messageRules", (o,n) => { (o as MailFolder).MessageRules = n.GetCollectionOfObjectValues<MessageRule>().ToList(); } },
{"messages", (o,n) => { (o as MailFolder).Messages = n.GetCollectionOfObjectValues<Message>().ToList(); } },
{"multiValueExtendedProperties", (o,n) => { (o as MailFolder).MultiValueExtendedProperties = n.GetCollectionOfObjectValues<MultiValueLegacyExtendedProperty>().ToList(); } },
{"messageRules", (o,n) => { (o as MailFolder).MessageRules = n.GetCollectionOfObjectValues<MessageRule>(MessageRule.CreateFromDiscriminatorValue).ToList(); } },
{"messages", (o,n) => { (o as MailFolder).Messages = n.GetCollectionOfObjectValues<Message>(Message.CreateFromDiscriminatorValue).ToList(); } },
{"multiValueExtendedProperties", (o,n) => { (o as MailFolder).MultiValueExtendedProperties = n.GetCollectionOfObjectValues<MultiValueLegacyExtendedProperty>(MultiValueLegacyExtendedProperty.CreateFromDiscriminatorValue).ToList(); } },
{"parentFolderId", (o,n) => { (o as MailFolder).ParentFolderId = n.GetStringValue(); } },
{"singleValueExtendedProperties", (o,n) => { (o as MailFolder).SingleValueExtendedProperties = n.GetCollectionOfObjectValues<SingleValueLegacyExtendedProperty>().ToList(); } },
{"singleValueExtendedProperties", (o,n) => { (o as MailFolder).SingleValueExtendedProperties = n.GetCollectionOfObjectValues<SingleValueLegacyExtendedProperty>(SingleValueLegacyExtendedProperty.CreateFromDiscriminatorValue).ToList(); } },
{"totalItemCount", (o,n) => { (o as MailFolder).TotalItemCount = n.GetIntValue(); } },
{"unreadItemCount", (o,n) => { (o as MailFolder).UnreadItemCount = n.GetIntValue(); } },
};
Expand Down
Loading

0 comments on commit 63f3aec

Please sign in to comment.