Skip to content

Commit 52ae1ca

Browse files
[OpenApi] Use GetCustomAttributes<T> (#62987)
Use `GetCustomAttributes<T>()` instead of `GetCustomAttributes().OfType<ValidationAttribute>()` to avoid need to use LINQ.
1 parent 7296d4d commit 52ae1ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ internal static void ApplyParameterInfo(this JsonNode schema, ApiParameterDescri
340340
schema.ApplyDefaultValue(defaultValueAttribute.Value, jsonTypeInfo);
341341
}
342342

343-
if (parameterInfo.GetCustomAttributes().OfType<ValidationAttribute>() is { } validationAttributes)
343+
if (parameterInfo.GetCustomAttributes<ValidationAttribute>() is { } validationAttributes)
344344
{
345345
schema.ApplyValidationAttributes(validationAttributes);
346346
}

0 commit comments

Comments
 (0)