From 12e084148616a3536c8bd1a6ab8281172a73ab89 Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 4 Mar 2024 14:22:09 -0500 Subject: [PATCH] remove all instances of Required.AllowNull --- Elements/src/CoreModels/RepresentationInstance.cs | 2 +- Elements/src/GeometricElement.cs | 8 ++++---- Elements/src/Geometry/Circle.cs | 2 +- Elements/src/Geometry/Plane.cs | 4 ++-- Elements/src/Geometry/Profile.cs | 4 ++-- Elements/src/Geometry/Solids/Extrude.cs | 4 ++-- Elements/src/Geometry/Solids/Lamina.cs | 4 ++-- Elements/src/Geometry/Triangle.cs | 2 +- Elements/src/Geometry/Vertex.cs | 4 ++-- Elements/src/Model.cs | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Elements/src/CoreModels/RepresentationInstance.cs b/Elements/src/CoreModels/RepresentationInstance.cs index 29914c2e8..13cfa1c99 100644 --- a/Elements/src/CoreModels/RepresentationInstance.cs +++ b/Elements/src/CoreModels/RepresentationInstance.cs @@ -43,7 +43,7 @@ public RepresentationInstance(ElementRepresentation representation, Material mat /// /// The representation's material. /// - [JsonProperty("Material", Required = Required.AllowNull)] + [JsonProperty("Material")] public Material Material { get; set; } /// diff --git a/Elements/src/GeometricElement.cs b/Elements/src/GeometricElement.cs index 95f81e3dc..d986a9761 100644 --- a/Elements/src/GeometricElement.cs +++ b/Elements/src/GeometricElement.cs @@ -39,15 +39,15 @@ public class GeometricElement : Element public BBox3 Bounds => _bounds; /// The element's transform. - [JsonProperty("Transform", Required = Required.AllowNull)] + [JsonProperty("Transform")] public Transform Transform { get; set; } /// The element's material. - [JsonProperty("Material", Required = Required.AllowNull)] + [JsonProperty("Material")] public Material Material { get; set; } /// The element's representation. - [JsonProperty("Representation", Required = Required.AllowNull)] + [JsonProperty("Representation")] public Representation Representation { get; set; } /// @@ -57,7 +57,7 @@ public class GeometricElement : Element public List RepresentationInstances { get; set; } = new List(); /// When true, this element will act as the base definition for element instances, and will not appear in visual output. - [JsonProperty("IsElementDefinition", Required = Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("IsElementDefinition", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsElementDefinition { get; set; } = false; /// diff --git a/Elements/src/Geometry/Circle.cs b/Elements/src/Geometry/Circle.cs index 69296293e..d02c4d250 100644 --- a/Elements/src/Geometry/Circle.cs +++ b/Elements/src/Geometry/Circle.cs @@ -13,7 +13,7 @@ namespace Elements.Geometry public class Circle : Curve, IConic { /// The center of the circle. - [JsonProperty("Center", Required = Required.AllowNull)] + [JsonProperty("Center", Required = Required.Always)] public Vector3 Center { get diff --git a/Elements/src/Geometry/Plane.cs b/Elements/src/Geometry/Plane.cs index bed51591a..6f7399026 100644 --- a/Elements/src/Geometry/Plane.cs +++ b/Elements/src/Geometry/Plane.cs @@ -11,11 +11,11 @@ namespace Elements.Geometry public partial class Plane : IEquatable { /// The origin of the plane. - [JsonProperty("Origin", Required = Required.AllowNull)] + [JsonProperty("Origin", Required = Required.Always)] public Vector3 Origin { get; set; } /// The normal of the plane. - [JsonProperty("Normal", Required = Required.AllowNull)] + [JsonProperty("Normal", Required = Required.Always)] public Vector3 Normal { get; set; } /// diff --git a/Elements/src/Geometry/Profile.cs b/Elements/src/Geometry/Profile.cs index db9e9a328..7abc31e89 100644 --- a/Elements/src/Geometry/Profile.cs +++ b/Elements/src/Geometry/Profile.cs @@ -13,11 +13,11 @@ namespace Elements.Geometry public class Profile : Element, IEquatable { /// The perimeter of the profile. - [JsonProperty("Perimeter", Required = Required.AllowNull)] + [JsonProperty("Perimeter", Required = Required.Always)] public Polygon Perimeter { get; set; } /// A collection of Polygons representing voids in the profile. - [JsonProperty("Voids", Required = Required.AllowNull)] + [JsonProperty("Voids")] public IList Voids { get; set; } /// diff --git a/Elements/src/Geometry/Solids/Extrude.cs b/Elements/src/Geometry/Solids/Extrude.cs index 4af71ef56..493c2ab25 100644 --- a/Elements/src/Geometry/Solids/Extrude.cs +++ b/Elements/src/Geometry/Solids/Extrude.cs @@ -16,7 +16,7 @@ public class Extrude : SolidOperation, System.ComponentModel.INotifyPropertyChan private bool _reverseWinding; /// The id of the profile to extrude. - [JsonProperty("Profile", Required = Required.AllowNull)] + [JsonProperty("Profile", Required = Required.Always)] public Profile Profile { get { return _profile; } @@ -47,7 +47,7 @@ public double Height } /// The direction in which to extrude. - [JsonProperty("Direction", Required = Required.AllowNull)] + [JsonProperty("Direction", Required = Required.Always)] public Vector3 Direction { get { return _direction; } diff --git a/Elements/src/Geometry/Solids/Lamina.cs b/Elements/src/Geometry/Solids/Lamina.cs index e9e8331b4..deab66d0d 100644 --- a/Elements/src/Geometry/Solids/Lamina.cs +++ b/Elements/src/Geometry/Solids/Lamina.cs @@ -12,7 +12,7 @@ public class Lamina : SolidOperation private IList _voids; /// The perimeter. - [JsonProperty("Perimeter", Required = Required.AllowNull)] + [JsonProperty("Perimeter", Required = Required.Always)] public Polygon Perimeter { get { return _perimeter; } @@ -29,7 +29,7 @@ public Polygon Perimeter /// /// A collection of voids. /// - [JsonProperty("Voids", Required = Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Voids", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public IList Voids { get { return _voids; } diff --git a/Elements/src/Geometry/Triangle.cs b/Elements/src/Geometry/Triangle.cs index 32f5c7a6f..dc4d63ed9 100644 --- a/Elements/src/Geometry/Triangle.cs +++ b/Elements/src/Geometry/Triangle.cs @@ -17,7 +17,7 @@ public class Triangle public IList Vertices { get; set; } = new List(); /// The triangle's normal. - [JsonProperty("Normal", Required = Required.AllowNull)] + [JsonProperty("Normal")] public Vector3 Normal { get; set; } /// diff --git a/Elements/src/Geometry/Vertex.cs b/Elements/src/Geometry/Vertex.cs index 8fd2b0752..9405ba649 100644 --- a/Elements/src/Geometry/Vertex.cs +++ b/Elements/src/Geometry/Vertex.cs @@ -9,11 +9,11 @@ namespace Elements.Geometry public class Vertex { /// The vertex's position. - [JsonProperty("Position", Required = Required.AllowNull)] + [JsonProperty("Position", Required = Required.Always)] public Vector3 Position { get; set; } /// The vertex's normal. - [JsonProperty("Normal", Required = Required.AllowNull)] + [JsonProperty("Normal")] public Vector3 Normal { get; set; } /// The vertex's color. diff --git a/Elements/src/Model.cs b/Elements/src/Model.cs index e8ef42228..e86af5726 100644 --- a/Elements/src/Model.cs +++ b/Elements/src/Model.cs @@ -22,12 +22,12 @@ namespace Elements public class Model { /// The origin of the model. - [JsonProperty("Origin", Required = Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Origin", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Obsolete("Use Transform instead.")] public Position Origin { get; set; } /// The transform of the model. - [JsonProperty("Transform", Required = Required.AllowNull)] + [JsonProperty("Transform")] public Transform Transform { get; set; } /// A collection of Elements keyed by their identifiers.