Skip to content

Commit

Permalink
fix: Fixed methods with same query and path names.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jun 15, 2024
1 parent 792358f commit 17375d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static string GenerateExtensionMethod(
var request = new {endPoint.RequestType.CSharpTypeWithoutNullability}
{{
{endPoint.Properties.Where(x => x.ParameterLocation == null && (x.IsRequired || !x.IsDeprecated)).Select(x => $@"
{x.Name} = {x.ParameterName},").Inject()}
{(x.Name.StartsWith("request", StringComparison.Ordinal) ? x.Name.Replace("request", string.Empty) : x.Name)} = {x.ParameterName},").Inject()}
}};
{response}{endPoint.MethodName}(
Expand Down
16 changes: 8 additions & 8 deletions src/libs/OpenApiGenerator.Core/Models/EndPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,17 @@ public static EndPoint FromSchema(
var properties = parameters.ToList();
foreach (var requestProperty in requestModel?.Properties ?? [])
{
//if (properties.All(x => x.Name != requestProperty.Name))
if (properties.All(x => x.Name != requestProperty.Name))
{
properties.Add(requestProperty);
}
// else
// {
// properties.Add(requestProperty with
// {
// Name = $"request{requestProperty.Name.ToPropertyName()}",
// });
// }
else
{
properties.Add(requestProperty with
{
Name = $"request{requestProperty.Name.ToPropertyName()}",
});
}
}

var endPoint = new EndPoint(
Expand Down

0 comments on commit 17375d8

Please sign in to comment.