-
Notifications
You must be signed in to change notification settings - Fork 11
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
Expression validation #311
Conversation
foreach (var file in files) | ||
{ | ||
var data = File.ReadAllText(file); | ||
ExpressionValidationTestModel testCase = JsonSerializer.Deserialize<ExpressionValidationTestModel>( | ||
data, | ||
new JsonSerializerOptions | ||
{ | ||
ReadCommentHandling = JsonCommentHandling.Skip, | ||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, | ||
})!; | ||
yield return new object[] { testCase }; | ||
} |
Check notice
Code scanning / CodeQL
Missed opportunity to use Select Note test
maps its iteration variable to another variable
0f837b9
to
ee4527a
Compare
e829a24
to
b84a621
Compare
SonarCloud Quality Gate failed. 1 Bug 53.6% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
catch | ||
{ | ||
logger.LogError($"Error while evaluating expression validation for {resolvedField}"); | ||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I think throwing is the best solution. Returning a validation error tied to the data would present the user with an error he cannot do anything about, tied to a field where he possibly have provided the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catch | ||
{ | ||
logger.LogError($"Error while evaluating expression validation for {resolvedField}"); | ||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Æsj, jeg burde sett dette før.
Det er lurt å sende med exception i loggen, og også gjøre meldingen parametrisk så man kan lage bedre queries i application insights.
catch | |
{ | |
logger.LogError($"Error while evaluating expression validation for {resolvedField}"); | |
throw; | |
catch(Exception e) | |
{ | |
logger.LogError(e, "Error while evaluating expression validation for {resolvedField}", resolvedField); | |
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice catch, I missed that one 🙈 fix in new PR: #319
Description
ExpressionValidation
is enabled inAppSettings
.argv
expression for getting arguments passed to expressions. (used to get the dataModel field the validation is for)RemoveHiddenDataPreview
setting has been replaced with:RemoveHiddenData
: Removes hidden data on submitRequiredValidation
: Runs required validations (will run hidden expressions first regardless of the flag above, but does not affect submission)dataModel
expression to only return "legal" values and null if it is an object or array. This logic previously only existed inJsonDataModel
(used for running shared tests) and not in the regularDataModel
class. So the tests were passing while the implementation used in practice was wrong. This logic has been removed fromJsonDataModel
to match the actualDataModel
implementation since other places in the code relies on getting objects and arrays from the datamodel.JsonDataModel
to useJsonNode
instead ofJsonElement
.JsonNode
is mutable and was needed to be able to implementRemoveField
for shared testing.Related Issue(s)
Verification
Documentation