-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add eval reasons support #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d30fe21
log eval reason
phaym 4e0b9fe
return eval reason from variable method
phaym 4723c74
working local reasons and defaults
phaym 68bf242
fix eval serialization for allVariables/Features
phaym 1179312
try to fix test-harness
phaym 5802214
fix test-harness again
phaym b512246
add some unit tests
phaym 41448f9
add evalReason tests
phaym 0591546
add more tests
phaym 141ac24
use Unkown when reason not in enum, test json serailizing
phaym 18ee41e
remove unreachable path, add tests for typemismatch
phaym 5c2da46
update enum to match strings
phaym b5245fa
update wasm to latest
phaym 04a5816
convert reason to string from enum
phaym c374e85
accidently removed ignore null types
phaym 7c0752b
enable events evalReason
phaym 0cb3180
downgrade wasm before events added
phaym ee5783b
remove event capability
phaym ab5c292
remove unused consts
phaym 5bb62ba
deprecate evalReason
phaym 1f6f949
handle cloud cases
phaym b419db8
enable cloud eval reason
phaym c76b8f1
fix cloud mapping for eval
phaym 7a52f83
refactor test client as reusable between tests
phaym File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| using System; | ||
| using System.Runtime.Serialization; | ||
| using System.Text; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace DevCycle.SDK.Server.Common.Model | ||
| { | ||
| [DataContract] | ||
| public class EvalReason : IEquatable<EvalReason> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="EvalReason" /> class. | ||
| /// </summary> | ||
| /// <param name="reason">The evaluation reason (required).</param> | ||
| /// <param name="details">Additional details about the evaluation.</param> | ||
| /// <param name="targetId">Target identifier for the evaluation.</param> | ||
| public EvalReason(string reason = default, string details = default, string targetId = default) | ||
| { | ||
| Reason = reason ?? throw new ArgumentException("reason is a required property for EvalReason and cannot be null"); | ||
| Details = details; | ||
| TargetId = targetId; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The evaluation reason | ||
| /// </summary> | ||
| /// <value>The evaluation reason</value> | ||
| [DataMember(Name = "reason", EmitDefaultValue = false)] | ||
| [JsonProperty("reason")] | ||
| public string Reason { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Additional details about the evaluation | ||
| /// </summary> | ||
| /// <value>Additional details about the evaluation</value> | ||
| [DataMember(Name = "details", EmitDefaultValue = false)] | ||
| [JsonProperty("details")] | ||
| public string Details { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Target identifier for the evaluation | ||
| /// </summary> | ||
| /// <value>Target identifier for the evaluation</value> | ||
| [DataMember(Name = "targetId", EmitDefaultValue = false)] | ||
| [JsonProperty("targetId")] | ||
| public string TargetId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Returns the string presentation of the object | ||
| /// </summary> | ||
| /// <returns>String presentation of the object</returns> | ||
| public override string ToString() | ||
| { | ||
| var sb = new StringBuilder(); | ||
| sb.Append("class EvalReason {\n"); | ||
| sb.Append(" Reason: ").Append(Reason).Append("\n"); | ||
| sb.Append(" Details: ").Append(Details).Append("\n"); | ||
| sb.Append(" TargetId: ").Append(TargetId).Append("\n"); | ||
| sb.Append("}\n"); | ||
| return sb.ToString(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Returns the JSON string presentation of the object | ||
| /// </summary> | ||
| /// <returns>JSON string presentation of the object</returns> | ||
| public virtual string ToJson() | ||
| { | ||
| return JsonConvert.SerializeObject(this, Formatting.Indented); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Returns true if objects are equal | ||
| /// </summary> | ||
| /// <param name="input">Object to be compared</param> | ||
| /// <returns>Boolean</returns> | ||
| public override bool Equals(object input) | ||
| { | ||
| return Equals(input as EvalReason); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Returns true if EvalReason instances are equal | ||
| /// </summary> | ||
| /// <param name="input">Instance of EvalReason to be compared</param> | ||
| /// <returns>Boolean</returns> | ||
| public bool Equals(EvalReason input) | ||
| { | ||
| if (input == null) | ||
| return false; | ||
|
|
||
| return | ||
| ( | ||
| Reason == input.Reason || | ||
| (Reason != null && Reason.Equals(input.Reason)) | ||
| ) && | ||
| ( | ||
| Details == input.Details || | ||
| (Details != null && Details.Equals(input.Details)) | ||
| ) && | ||
| ( | ||
| TargetId == input.TargetId || | ||
| (TargetId != null && TargetId.Equals(input.TargetId)) | ||
| ); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the hash code | ||
| /// </summary> | ||
| /// <returns>Hash code</returns> | ||
| public override int GetHashCode() | ||
| { | ||
| unchecked // Overflow is fine, just wrap | ||
| { | ||
| int hashCode = 41; | ||
| if (Reason != null) | ||
| hashCode = hashCode * 59 + Reason.GetHashCode(); | ||
| if (Details != null) | ||
| hashCode = hashCode * 59 + Details.GetHashCode(); | ||
| if (TargetId != null) | ||
| hashCode = hashCode * 59 + TargetId.GetHashCode(); | ||
| return hashCode; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.