Skip to content

Commit

Permalink
Fix template and test bugs from PR RicoSuter#4541
Browse files Browse the repository at this point in the history
  • Loading branch information
paulomorgado committed Nov 5, 2023
1 parent 512eb65 commit 82057fd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
{% else -%}
public {{ Class }}()
{
{% endif -%}
{% if UseBaseUrl and GenerateBaseUrlProperty -%}
{% if UseBaseUrl and GenerateBaseUrlProperty -%}
BaseUrl = "{{ BaseUrl }}";
{% endif -%}
{% endif -%}
{% template Client.Class.Constructor %}
{% template Client.Class.Constructor %}
}

private static {{ JsonSerializerSettingsType }} CreateSerializerSettings({% if UseRequestAndResponseSerializationSettings %}bool isRequest{% endif %})
Expand All @@ -65,7 +65,7 @@
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace MyNamespace
{
BaseUrl = baseUrl;
_httpClient = httpClient;
BaseUrl = "";
}

private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
Expand All @@ -47,7 +46,7 @@ namespace MyNamespace
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down Expand Up @@ -327,7 +326,6 @@ namespace MyNamespace
{
BaseUrl = baseUrl;
_httpClient = httpClient;
BaseUrl = "";
}

private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
Expand All @@ -344,7 +342,7 @@ namespace MyNamespace
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace MyNamespace
{
BaseUrl = baseUrl;
_httpClient = httpClient;
BaseUrl = "";
}

private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
Expand All @@ -47,7 +46,7 @@ namespace MyNamespace
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down Expand Up @@ -327,7 +326,6 @@ namespace MyNamespace
{
BaseUrl = baseUrl;
_httpClient = httpClient;
BaseUrl = "";
}

private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
Expand All @@ -344,7 +342,7 @@ namespace MyNamespace
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/NSwag.Sample.NET80Minimal/GeneratedClientsCs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace MyNamespace
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down Expand Up @@ -344,7 +344,7 @@ namespace MyNamespace
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
baseUrl += '/';
_baseUrl += '/';
}
}

Expand Down

0 comments on commit 82057fd

Please sign in to comment.