Skip to content

Commit ff97305

Browse files
authored
Fix TNT-40917 Zero numeric values not included in serialized Delivery request (#18)
* Fix TNT-40917 Zero numeric values not included in serialized Delivery request * Fix security vulnerabilities in dev dependencies
1 parent a99e09c commit ff97305

40 files changed

+499
-136
lines changed

Source/Adobe.Target.Delivery/Adobe.Target.Delivery.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1717
<PackageReference Include="RestSharp" Version="106.11.4" />
1818
<PackageReference Include="Polly" Version="7.2.0" />
19-
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
19+
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
2020
</ItemGroup>
2121

2222
</Project>

Source/Adobe.Target.Delivery/Client/ClientUtils.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ public static Multimap<string, string> ParameterToMultiMap(string collectionForm
5656
parameters.Add(name, ParameterToString(item));
5757
}
5858
}
59+
else if (value is IDictionary dictionary)
60+
{
61+
if(collectionFormat == "deepObject") {
62+
foreach (DictionaryEntry entry in dictionary)
63+
{
64+
parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value));
65+
}
66+
}
67+
else {
68+
foreach (DictionaryEntry entry in dictionary)
69+
{
70+
parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value));
71+
}
72+
}
73+
}
5974
else
6075
{
6176
parameters.Add(name, ParameterToString(value));

Source/Adobe.Target.Delivery/Model/AnalyticsRequest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace Adobe.Target.Delivery.Model
3434
[DataContract(Name = "AnalyticsRequest")]
3535
public partial class AnalyticsRequest : IEquatable<AnalyticsRequest>, IValidatableObject
3636
{
37+
3738
/// <summary>
3839
/// Gets or Sets Logging
3940
/// </summary>

Source/Adobe.Target.Delivery/Model/AudienceManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public partial class AudienceManager : IEquatable<AudienceManager>, IValidatable
3939
/// </summary>
4040
/// <param name="locationHint">DCS location hint. Used to determine which AAM DCS Endpoint to hit in order to retrieve the profile. .</param>
4141
/// <param name="blob">AAM Blob. Used to send additional data to AAM. Validation * Cannot be blank. .</param>
42-
public AudienceManager(int locationHint = default(int), string blob = default(string))
42+
public AudienceManager(int? locationHint = default(int?), string blob = default(string))
4343
{
4444
this.LocationHint = locationHint;
4545
this.Blob = blob;
@@ -50,7 +50,7 @@ public partial class AudienceManager : IEquatable<AudienceManager>, IValidatable
5050
/// </summary>
5151
/// <value>DCS location hint. Used to determine which AAM DCS Endpoint to hit in order to retrieve the profile. </value>
5252
[DataMember(Name = "locationHint", EmitDefaultValue = false)]
53-
public int LocationHint { get; set; }
53+
public int? LocationHint { get; set; }
5454

5555
/// <summary>
5656
/// AAM Blob. Used to send additional data to AAM. Validation * Cannot be blank.

Source/Adobe.Target.Delivery/Model/AuthenticatedState.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ namespace Adobe.Target.Delivery.Model
3131
/// <summary>
3232
/// Defines AuthenticatedState
3333
/// </summary>
34-
3534
[JsonConverter(typeof(StringEnumConverter))]
36-
3735
public enum AuthenticatedState
3836
{
3937
/// <summary>

Source/Adobe.Target.Delivery/Model/ChannelType.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ namespace Adobe.Target.Delivery.Model
3232
/// Specifies the channel for the request. Only activities with the matching channel will be evaluated.
3333
/// </summary>
3434
/// <value>Specifies the channel for the request. Only activities with the matching channel will be evaluated. </value>
35-
3635
[JsonConverter(typeof(StringEnumConverter))]
37-
3836
public enum ChannelType
3937
{
4038
/// <summary>

Source/Adobe.Target.Delivery/Model/Context.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace Adobe.Target.Delivery.Model
3434
[DataContract(Name = "Context")]
3535
public partial class Context : IEquatable<Context>, IValidatableObject
3636
{
37+
3738
/// <summary>
3839
/// Gets or Sets Channel
3940
/// </summary>
@@ -58,7 +59,7 @@ protected Context() { }
5859
/// <param name="timeOffsetInMinutes">Specifies minutes from UTC for specific client.</param>
5960
/// <param name="userAgent">User-Agent should be sent only via this property. HTTP header User-Agent is ignored..</param>
6061
/// <param name="beacon">In case beacon &#x3D; true is provided in the request, the server will return a 204 No Content response with no response body. (default to false).</param>
61-
public Context(ChannelType channel = default(ChannelType), MobilePlatform mobilePlatform = default(MobilePlatform), Application application = default(Application), Screen screen = default(Screen), Window window = default(Window), Browser browser = default(Browser), Address address = default(Address), Geo geo = default(Geo), double timeOffsetInMinutes = default(double), string userAgent = default(string), bool beacon = false)
62+
public Context(ChannelType channel = default(ChannelType), MobilePlatform mobilePlatform = default(MobilePlatform), Application application = default(Application), Screen screen = default(Screen), Window window = default(Window), Browser browser = default(Browser), Address address = default(Address), Geo geo = default(Geo), double? timeOffsetInMinutes = default(double?), string userAgent = default(string), bool beacon = false)
6263
{
6364
this.Channel = channel;
6465
this.MobilePlatform = mobilePlatform;
@@ -120,7 +121,7 @@ protected Context() { }
120121
/// </summary>
121122
/// <value>Specifies minutes from UTC for specific client</value>
122123
[DataMember(Name = "timeOffsetInMinutes", EmitDefaultValue = false)]
123-
public double TimeOffsetInMinutes { get; set; }
124+
public double? TimeOffsetInMinutes { get; set; }
124125

125126
/// <summary>
126127
/// User-Agent should be sent only via this property. HTTP header User-Agent is ignored.
@@ -133,7 +134,7 @@ protected Context() { }
133134
/// In case beacon &#x3D; true is provided in the request, the server will return a 204 No Content response with no response body.
134135
/// </summary>
135136
/// <value>In case beacon &#x3D; true is provided in the request, the server will return a 204 No Content response with no response body. </value>
136-
[DataMember(Name = "beacon", EmitDefaultValue = false)]
137+
[DataMember(Name = "beacon", EmitDefaultValue = true)]
137138
public bool Beacon { get; set; }
138139

139140
/// <summary>

Source/Adobe.Target.Delivery/Model/CustomerId.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace Adobe.Target.Delivery.Model
3434
[DataContract(Name = "CustomerId")]
3535
public partial class CustomerId : IEquatable<CustomerId>, IValidatableObject
3636
{
37+
3738
/// <summary>
3839
/// Gets or Sets AuthenticatedState
3940
/// </summary>

Source/Adobe.Target.Delivery/Model/DecisioningMethod.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ namespace Adobe.Target.Delivery.Model
3131
/// <summary>
3232
/// Defines DecisioningMethod
3333
/// </summary>
34-
3534
[JsonConverter(typeof(StringEnumConverter))]
36-
3735
public enum DecisioningMethod
3836
{
3937
/// <summary>

Source/Adobe.Target.Delivery/Model/DeliveryRequest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected DeliveryRequest() { }
5656
/// <param name="notifications">Notifications for the displayed content, clicked selectors, and/or visited views or mboxes..</param>
5757
/// <param name="qaMode">qaMode.</param>
5858
/// <param name="preview">preview.</param>
59-
public DeliveryRequest(string requestId = default(string), string impressionId = default(string), VisitorId id = default(VisitorId), long environmentId = default(long), Property property = default(Property), Trace trace = default(Trace), Context context = default(Context), ExperienceCloud experienceCloud = default(ExperienceCloud), ExecuteRequest execute = default(ExecuteRequest), PrefetchRequest prefetch = default(PrefetchRequest), Telemetry telemetry = default(Telemetry), List<Notification> notifications = default(List<Notification>), QAMode qaMode = default(QAMode), Preview preview = default(Preview))
59+
public DeliveryRequest(string requestId = default(string), string impressionId = default(string), VisitorId id = default(VisitorId), long? environmentId = default(long?), Property property = default(Property), Trace trace = default(Trace), Context context = default(Context), ExperienceCloud experienceCloud = default(ExperienceCloud), ExecuteRequest execute = default(ExecuteRequest), PrefetchRequest prefetch = default(PrefetchRequest), Telemetry telemetry = default(Telemetry), List<Notification> notifications = default(List<Notification>), QAMode qaMode = default(QAMode), Preview preview = default(Preview))
6060
{
6161
// to ensure "context" is required (not null)
6262
this.Context = context ?? throw new ArgumentNullException("context is a required property for DeliveryRequest and cannot be null");
@@ -100,7 +100,7 @@ protected DeliveryRequest() { }
100100
/// </summary>
101101
/// <value>Valid client environment id. If not specified host will be determined base on the provided host.</value>
102102
[DataMember(Name = "environmentId", EmitDefaultValue = false)]
103-
public long EnvironmentId { get; set; }
103+
public long? EnvironmentId { get; set; }
104104

105105
/// <summary>
106106
/// Gets or Sets Property

0 commit comments

Comments
 (0)