File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
src/GraphODataTemplateWriter/Extensions Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ namespace <#=method.Namespace.GetNamespaceName()#>
3131 public partial class <#=requestBody#>
3232 {
3333 <#
34- foreach (var param in method.Parameters )
34+ foreach (var param in method.WithDistinctParameters() )
3535 {
3636 var paramTypeString = param.Type.GetTypeString(method.Namespace.GetNamespaceName());
3737
Original file line number Diff line number Diff line change @@ -500,11 +500,30 @@ public static List<OdcmMethod> WithDistinctOverloads(this OdcmMethod odcmMethod)
500500 return methods . Distinct ( methodComparer ) . ToList ( ) ;
501501 }
502502
503+ private static readonly OdcmParameterEqualityComparer paramComparer = new OdcmParameterEqualityComparer ( ) ;
504+ /// <summary>
505+ /// Deduplicates the parameter list for an overloaded method.
506+ /// </summary>
507+ /// <param name="odcmMethod">Method with potential overloads and duplicate parameters across overloads.</param>
508+ /// <returns>A deduplicated list of OdcmParameter.</returns>
509+ public static List < OdcmParameter > WithDistinctParameters ( this OdcmMethod odcmMethod )
510+ {
511+ var distinctMethods = odcmMethod . WithDistinctOverloads ( ) ;
512+
513+ var parameters = new List < OdcmParameter > ( ) ;
514+
515+ foreach ( var method in distinctMethods )
516+ {
517+ parameters . AddRange ( method . Parameters ) ;
518+ }
519+
520+ return parameters . Distinct ( paramComparer ) . ToList ( ) ;
521+ }
522+
503523 /// Returns a List containing the supplied class' methods plus their overloads
504524 public static IEnumerable < OdcmMethod > MethodsAndOverloads ( this OdcmClass odcmClass )
505525 {
506526 return odcmClass . Methods . SelectMany ( x => x . WithOverloads ( ) ) ;
507527 }
508528 }
509-
510529}
You can’t perform that action at this time.
0 commit comments