File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed
Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,10 @@ var method = host.CurrentType.AsOdcmMethod();
77var entityName = method.Class.Name.ToCheckedCase();
88var requestBody = entityName + method.Name.Substring(method.Name.IndexOf('.') + 1).ToCheckedCase() + "RequestBody";
99
10- // These types of request bodies are only used for OData actions, which when containing parameters,
11- // will always result in POST calls. The OData spec is explicit in saying that overload methods bound
12- // to other types are explicitly not allowed. Therefore, any overload methods found here are invalid
13- // and violate the spec.
14- System.Diagnostics.Debug.Assert(!method.Overloads.Any(), "Overload actions are not allowed in OData services");
10+ // Commenting this out as 12.1.1.1, Action Overload Rules, states "Bound actions support overloading (multiple
11+ // actions having the same name within the same namespace) by binding parameter type. The combination of action
12+ // name and the binding parameter type MUST be unique within a namespace."
13+ // System.Diagnostics.Debug.Assert(!method.Overloads.Any(), "Overload actions are not allowed in OData services");
1514
1615var attributeStringBuilder = new StringBuilder();
1716attributeStringBuilder.Append("[JsonObject(MemberSerialization = MemberSerialization.OptIn)]");
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ namespace <#=method.Namespace.GetNamespaceName()#>
298298 /// </summary>
299299 /// <param name="<#=returnEntityParameter#>">The <#=returnEntityType#> object set with the properties to update.</param>
300300 /// <returns>The task to await for async call.</returns>
301- public <#=methodReturnType #> PatchAsync(<#=returnEntityType#> <#=returnEntityParameter#>)
301+ public <#=methodOverloadReturnType #> PatchAsync(<#=returnEntityType#> <#=returnEntityParameter#>)
302302 {
303303 return this.PatchAsync(<#=returnEntityParameter#>, CancellationToken.None);
304304 }
@@ -399,7 +399,7 @@ namespace <#=method.Namespace.GetNamespaceName()#>
399399 /// </summary>
400400 /// <param name="<#=returnEntityParameter#>">The <#=returnEntityType#> object to update.</param>
401401 /// <returns>The task to await for async call.</returns>
402- public <#=methodReturnType #> PutAsync(<#=returnEntityType#> <#=returnEntityParameter#>)
402+ public <#=methodOverloadReturnType #> PutAsync(<#=returnEntityType#> <#=returnEntityParameter#>)
403403 {
404404 return this.PutAsync(<#=returnEntityParameter#>, CancellationToken.None);
405405 }
Original file line number Diff line number Diff line change @@ -14,7 +14,16 @@ var methodType = method.IsFunction ? "Function" : "Action";
1414
1515var overloads = new List<OdcmMethod>();
1616overloads.Add(method);
17- overloads.AddRange(method.Overloads);
17+
18+ // So far, it appears that the overloads on the functions are working as expected.
19+ // The overloads on actions should be skipped. If we see more issues here, we may need to
20+ // revisit how VIPR determines overloaded methods.
21+ if (method.IsFunction)
22+ {
23+ overloads.AddRange(method.Overloads);
24+ }
25+
26+
1827
1928var methods = overloads
2029 .Select(m =>
@@ -66,7 +75,9 @@ namespace <#=method.Namespace.GetNamespaceName()#>
6675 {
6776<#
6877foreach (var m in methods)
78+
6979{
80+
7081#>
7182 /// <summary>
7283 /// Constructs a new <see cref="<#=requestBuilderType#>"/>.
You can’t perform that action at this time.
0 commit comments