Skip to content
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

[.NET] Return warning when validated inputs don't have an error message #4885

Merged
merged 10 commits into from
Oct 22, 2020

Conversation

RebeccaAnne
Copy link
Contributor

@RebeccaAnne RebeccaAnne commented Oct 5, 2020

Related Issue

Fixes #4449

Description

Add warnings for validated inputs without error messages for .NET.

How Verified

.NET tests passed. Confirmed expected behavior using existing MissingErrorMessages.json sample card.

Microsoft Reviewers: Open in CodeFlow

@RebeccaAnne
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

if (input.IsRequired && input.ErrorMessage == null)
{
context.Warnings.Add(new AdaptiveWarning((int)AdaptiveWarning.WarningStatusCode.NoWarningForValidatedInput,
"Inputs with validation should include an ErrorMessage"));
Copy link
Member

@shalinijoshi19 shalinijoshi19 Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RebeccaAnne do we have a plan to localize these error strings that we bubble out via the AdaptiveWarning/Error object(s)? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not currently any plan to localize warning strings. I added it to the doc i'm working on that covers possible areas for localization.


In reply to: 501253546 [](ancestors = 501253546)

if (input.IsRequired && input.ErrorMessage == null)
{
context.Warnings.Add(new AdaptiveWarning((int)AdaptiveWarning.WarningStatusCode.NoWarningForValidatedInput,
"Inputs with validation should include an ErrorMessage"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a common place in the shared .NET library that we could house this string as a variable to reference in all these places vs needing to hardcode the literal each place?

@@ -40,6 +40,12 @@ public static FrameworkElement Render(AdaptiveDateInput input, AdaptiveRenderCon
datePicker.Style = context.GetStyle("Adaptive.Input.Date");
datePicker.DataContext = input;

if (input.IsRequired && input.ErrorMessage == null)
Copy link
Member

@shalinijoshi19 shalinijoshi19 Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What;s our behavior for empty or whitespace-only values for the ErrorMessage? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Fixed.


In reply to: 501254812 [](ancestors = 501254812)

@ghost ghost added the no-recent-activity label Oct 19, 2020
@ghost ghost assigned shalinijoshi19 Oct 19, 2020
@ghost
Copy link

ghost commented Oct 19, 2020

Hi @RebeccaAnne. This non-spec pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along.

@ghost ghost removed the no-recent-activity label Oct 19, 2020
@ghost
Copy link

ghost commented Oct 19, 2020

Hi @RebeccaAnne; Thanks for taking action on your previously stale pull request. Resetting staleness.

@RebeccaAnne RebeccaAnne merged commit 2d4be0d into main Oct 22, 2020
@RebeccaAnne RebeccaAnne deleted the rebecch/dotnetValidationWarnings branch October 22, 2020 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[.NET][Input Validation] Return warning if validation properties exist without an errorMessage
2 participants