Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix template and test bugs from PR #4541 #4570

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 -%}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems of with BaseUrl, the property isn't assigned due to this when run with NSwagStudio 13.20.0.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you replacing NSwagStudio 13.20.0.0 templates with this one?

Can you share a simple repro?

{% 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
Loading