Skip to content

Commit d8e29a6

Browse files
Update type check
- Check for a generic type before type name check. - Replace `StartsWith()` with `==`.
1 parent bf9b7dd commit d8e29a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/OpenApi/src/Extensions/TypeExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public static bool IsJsonPatchDocument(this Type type)
1919
while (modelType != null && modelType != typeof(object))
2020
{
2121
if (modelType.Namespace == JsonPatchDocumentNamespace &&
22-
(modelType.Name == JsonPatchDocumentName || modelType.Name.StartsWith(JsonPatchDocumentNameOfT, StringComparison.Ordinal)))
22+
(modelType.Name == JsonPatchDocumentName ||
23+
(modelType.IsGenericType && modelType.GenericTypeArguments.Length == 1 && modelType.Name == JsonPatchDocumentNameOfT)))
2324
{
2425
return true;
2526
}

0 commit comments

Comments
 (0)