@@ -56,14 +56,14 @@ public string GetOperationId(ApiDescription endpoint)
56
56
throw new UnreachableCodeException ( ) ;
57
57
}
58
58
59
- string template = GetTemplate ( primaryResourceType . ClrType , endpoint ) ;
59
+ string template = GetTemplate ( endpoint ) ;
60
60
61
61
return ApplyTemplate ( template , primaryResourceType , endpoint ) ;
62
62
}
63
63
64
- private static string GetTemplate ( Type resourceClrType , ApiDescription endpoint )
64
+ private static string GetTemplate ( ApiDescription endpoint )
65
65
{
66
- Type requestDocumentType = GetDocumentType ( resourceClrType , endpoint ) ;
66
+ Type requestDocumentType = GetDocumentType ( endpoint ) ;
67
67
68
68
if ( ! DocumentOpenTypeToOperationIdTemplateMap . TryGetValue ( requestDocumentType , out string ? template ) )
69
69
{
@@ -73,7 +73,7 @@ private static string GetTemplate(Type resourceClrType, ApiDescription endpoint)
73
73
return template ;
74
74
}
75
75
76
- private static Type GetDocumentType ( Type primaryResourceClrType , ApiDescription endpoint )
76
+ private static Type GetDocumentType ( ApiDescription endpoint )
77
77
{
78
78
var producesResponseTypeAttribute = endpoint . ActionDescriptor . GetFilterMetadata < ProducesResponseTypeAttribute > ( ) ;
79
79
@@ -87,14 +87,9 @@ private static Type GetDocumentType(Type primaryResourceClrType, ApiDescription
87
87
Type documentType = requestBodyDescriptor ? . ParameterType . GetGenericTypeDefinition ( ) ??
88
88
GetGenericTypeDefinition ( producesResponseTypeAttribute . Type ) ?? producesResponseTypeAttribute . Type ;
89
89
90
- if ( documentType == typeof ( ResourceCollectionResponseDocument < > ) )
90
+ if ( documentType == typeof ( ResourceCollectionResponseDocument < > ) && endpoint . ParameterDescriptions . Count > 0 )
91
91
{
92
- Type documentResourceType = producesResponseTypeAttribute . Type . GetGenericArguments ( ) [ 0 ] ;
93
-
94
- if ( documentResourceType != primaryResourceClrType )
95
- {
96
- documentType = typeof ( SecondaryResourceResponseDocument < > ) ;
97
- }
92
+ documentType = typeof ( SecondaryResourceResponseDocument < > ) ;
98
93
}
99
94
100
95
return documentType ;
0 commit comments