Skip to content

Commit 5b7d100

Browse files
[OpenApi] Use GetCustomAttributes<T>
Use `GetCustomAttributes<T>()` instead of `GetCustomAttributes().OfType<ValidationAttribute>()` to avoid need to use LINQ.
1 parent 02125bd commit 5b7d100

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
@@ -320,7 +320,7 @@ internal static void ApplyParameterInfo(this JsonNode schema, ApiParameterDescri
320320
schema.ApplyDefaultValue(defaultValueAttribute.Value, jsonTypeInfo);
321321
}
322322

323-
if (parameterInfo.GetCustomAttributes().OfType<ValidationAttribute>() is { } validationAttributes)
323+
if (parameterInfo.GetCustomAttributes<ValidationAttribute>() is { } validationAttributes)
324324
{
325325
schema.ApplyValidationAttributes(validationAttributes);
326326
}

0 commit comments

Comments
 (0)