Skip to content

Commit 042f4a9

Browse files
authored
fix: change to not throw when a validator is not of type AttributeValidator (#431)
Co-authored-by: Steve Kirchner <skirchner@loopbackanalytics.com>
1 parent 1d6e1a5 commit 042f4a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected virtual void GenerateArguments(
194194
var description = arg.Description;
195195
var allowedValuesBeenSet = false;
196196

197-
foreach (var attributeValidator in arg.Validators.Cast<AttributeValidator>())
197+
foreach (var attributeValidator in arg.Validators.OfType<AttributeValidator>())
198198
{
199199
if (attributeValidator?.ValidationAttribute is AllowedValuesAttribute allowedValuesAttribute)
200200
{
@@ -251,7 +251,7 @@ protected virtual void GenerateOptions(
251251
var description = opt.Description;
252252
var allowedValuesBeenSet = false;
253253

254-
foreach (var attributeValidator in opt.Validators.Cast<AttributeValidator>())
254+
foreach (var attributeValidator in opt.Validators.OfType<AttributeValidator>())
255255
{
256256
if (attributeValidator?.ValidationAttribute is AllowedValuesAttribute allowedValuesAttribute)
257257
{

0 commit comments

Comments
 (0)