Skip to content

Commit

Permalink
Merge pull request #1078 from hypar-io/no-allow-null
Browse files Browse the repository at this point in the history
remove all instances of Required.AllowNull
  • Loading branch information
andrewheumann committed Mar 4, 2024
2 parents 2e7592e + 12e0841 commit a5e8195
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Elements/src/CoreModels/RepresentationInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public RepresentationInstance(ElementRepresentation representation, Material mat
/// <summary>
/// The representation's material.
/// </summary>
[JsonProperty("Material", Required = Required.AllowNull)]
[JsonProperty("Material")]
public Material Material { get; set; }

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Elements/src/GeometricElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public class GeometricElement : Element
public BBox3 Bounds => _bounds;

/// <summary>The element's transform.</summary>
[JsonProperty("Transform", Required = Required.AllowNull)]
[JsonProperty("Transform")]
public Transform Transform { get; set; }

/// <summary>The element's material.</summary>
[JsonProperty("Material", Required = Required.AllowNull)]
[JsonProperty("Material")]
public Material Material { get; set; }

/// <summary>The element's representation.</summary>
[JsonProperty("Representation", Required = Required.AllowNull)]
[JsonProperty("Representation")]
public Representation Representation { get; set; }

/// <summary>
Expand All @@ -57,7 +57,7 @@ public class GeometricElement : Element
public List<RepresentationInstance> RepresentationInstances { get; set; } = new List<RepresentationInstance>();

/// <summary>When true, this element will act as the base definition for element instances, and will not appear in visual output.</summary>
[JsonProperty("IsElementDefinition", Required = Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[JsonProperty("IsElementDefinition", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool IsElementDefinition { get; set; } = false;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Elements/src/Geometry/Circle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Elements.Geometry
public class Circle : Curve, IConic
{
/// <summary>The center of the circle.</summary>
[JsonProperty("Center", Required = Required.AllowNull)]
[JsonProperty("Center", Required = Required.Always)]
public Vector3 Center
{
get
Expand Down
4 changes: 2 additions & 2 deletions Elements/src/Geometry/Plane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ namespace Elements.Geometry
public partial class Plane : IEquatable<Plane>
{
/// <summary>The origin of the plane.</summary>
[JsonProperty("Origin", Required = Required.AllowNull)]
[JsonProperty("Origin", Required = Required.Always)]
public Vector3 Origin { get; set; }

/// <summary>The normal of the plane.</summary>
[JsonProperty("Normal", Required = Required.AllowNull)]
[JsonProperty("Normal", Required = Required.Always)]
public Vector3 Normal { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Elements/src/Geometry/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ namespace Elements.Geometry
public class Profile : Element, IEquatable<Profile>
{
/// <summary>The perimeter of the profile.</summary>
[JsonProperty("Perimeter", Required = Required.AllowNull)]
[JsonProperty("Perimeter", Required = Required.Always)]
public Polygon Perimeter { get; set; }

/// <summary>A collection of Polygons representing voids in the profile.</summary>
[JsonProperty("Voids", Required = Required.AllowNull)]
[JsonProperty("Voids")]
public IList<Polygon> Voids { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Elements/src/Geometry/Solids/Extrude.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Extrude : SolidOperation, System.ComponentModel.INotifyPropertyChan
private bool _reverseWinding;

/// <summary>The id of the profile to extrude.</summary>
[JsonProperty("Profile", Required = Required.AllowNull)]
[JsonProperty("Profile", Required = Required.Always)]
public Profile Profile
{
get { return _profile; }
Expand Down Expand Up @@ -47,7 +47,7 @@ public double Height
}

/// <summary>The direction in which to extrude.</summary>
[JsonProperty("Direction", Required = Required.AllowNull)]
[JsonProperty("Direction", Required = Required.Always)]
public Vector3 Direction
{
get { return _direction; }
Expand Down
4 changes: 2 additions & 2 deletions Elements/src/Geometry/Solids/Lamina.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Lamina : SolidOperation
private IList<Polygon> _voids;

/// <summary>The perimeter.</summary>
[JsonProperty("Perimeter", Required = Required.AllowNull)]
[JsonProperty("Perimeter", Required = Required.Always)]
public Polygon Perimeter
{
get { return _perimeter; }
Expand All @@ -29,7 +29,7 @@ public Polygon Perimeter
/// <summary>
/// A collection of voids.
/// </summary>
[JsonProperty("Voids", Required = Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[JsonProperty("Voids", NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public IList<Polygon> Voids
{
get { return _voids; }
Expand Down
2 changes: 1 addition & 1 deletion Elements/src/Geometry/Triangle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Triangle
public IList<Vertex> Vertices { get; set; } = new List<Vertex>();

/// <summary>The triangle's normal.</summary>
[JsonProperty("Normal", Required = Required.AllowNull)]
[JsonProperty("Normal")]
public Vector3 Normal { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Elements/src/Geometry/Vertex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ namespace Elements.Geometry
public class Vertex
{
/// <summary>The vertex's position.</summary>
[JsonProperty("Position", Required = Required.AllowNull)]
[JsonProperty("Position", Required = Required.Always)]
public Vector3 Position { get; set; }

/// <summary>The vertex's normal.</summary>
[JsonProperty("Normal", Required = Required.AllowNull)]
[JsonProperty("Normal")]
public Vector3 Normal { get; set; }

/// <summary>The vertex's color.</summary>
Expand Down
4 changes: 2 additions & 2 deletions Elements/src/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ namespace Elements
public class Model
{
/// <summary>The origin of the model.</summary>
[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; }

/// <summary>The transform of the model.</summary>
[JsonProperty("Transform", Required = Required.AllowNull)]
[JsonProperty("Transform")]
public Transform Transform { get; set; }

/// <summary>A collection of Elements keyed by their identifiers.</summary>
Expand Down

0 comments on commit a5e8195

Please sign in to comment.