fix: С# client generation is missing default values for parameters #5311
+6
−6
Annotations
7 errors and 1 warning
|
Run: Compile, Test, Pack
$GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 13250k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary
|
|
Run: Compile, Test, Pack
Process completed with exit code 1.
|
|
Run: Compile, Test, Pack
Target "Test" has thrown an exception
|
|
Run: Compile, Test, Pack:
src/NSwag.CodeGeneration.CSharp.Tests/ClientGenerationTests.cs#L14
VerifyException : Directory: D:\a\NSwag\NSwag\src\NSwag.CodeGeneration.CSharp.Tests\Snapshots
NotEqual:
- Received: ShipBob_OpenAPI.received.txt
Verified: ShipBob_OpenAPI.verified.txt
FileContent:
NotEqual:
Received: ShipBob_OpenAPI.received.txt
namespace MyNamespace
{
using System = global::System;
public partial class Client
{
#pragma warning disable 8618
private string _baseUrl;
#pragma warning restore 8618
private System.Net.Http.HttpClient _httpClient;
private static System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(CreateSerializerSettings, true);
private Newtonsoft.Json.JsonSerializerSettings _instanceSettings;
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public Client(System.Net.Http.HttpClient httpClient)
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
{
BaseUrl = "https://api.shipbob.com/2025-07";
_httpClient = httpClient;
Initialize();
}
private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
{
var settings = new Newtonsoft.Json.JsonSerializerSettings();
UpdateJsonSerializerSettings(settings);
return settings;
}
public string BaseUrl
{
get { return _baseUrl; }
set
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
_baseUrl += '/';
}
}
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } }
static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings);
partial void Initialize();
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>
/// Get channels
/// </summary>
/// <param name="recordsPerPage">The number of records to return per page. This parameter is used for pagination. If not provided, a default value will be used.</param>
/// <param name="cursor">A cursor for pagination. This parameter is used to fetch the next set of results.</param>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<ChannelsV2ViewModel> C94a92715c0351cba55c1eff9c4649f2Async(int? recordsPerPage = 50, string cursor = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Method = new System.Net.Http.HttpMethod("GET");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "channel"
urlBuilder_.Append("channel");
|
|
Run: Compile, Test, Pack:
src/NSwag.CodeGeneration.CSharp.Tests/ClientGenerationTests.cs#L8
VerifyException : Directory: D:\a\NSwag\NSwag\src\NSwag.CodeGeneration.CSharp.Tests\Snapshots
NotEqual:
- Received: JIRA_OpenAPI.received.txt
Verified: JIRA_OpenAPI.verified.txt
FileContent:
NotEqual:
Received: JIRA_OpenAPI.received.txt
namespace MyNamespace
{
using System = global::System;
public partial class Client
{
#pragma warning disable 8618
private string _baseUrl;
#pragma warning restore 8618
private System.Net.Http.HttpClient _httpClient;
private static System.Lazy<Newtonsoft.Json.JsonSerializerSettings> _settings = new System.Lazy<Newtonsoft.Json.JsonSerializerSettings>(CreateSerializerSettings, true);
private Newtonsoft.Json.JsonSerializerSettings _instanceSettings;
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public Client(System.Net.Http.HttpClient httpClient)
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
{
BaseUrl = "https://your-domain.atlassian.net";
_httpClient = httpClient;
Initialize();
}
private static Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings()
{
var settings = new Newtonsoft.Json.JsonSerializerSettings();
UpdateJsonSerializerSettings(settings);
return settings;
}
public string BaseUrl
{
get { return _baseUrl; }
set
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
_baseUrl += '/';
}
}
protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _instanceSettings ?? _settings.Value; } }
static partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings);
partial void Initialize();
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url);
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>
/// Get announcement banner configuration
/// </summary>
/// <remarks>
/// Returns the current announcement banner configuration.
/// <br/>
/// <br/>**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
/// </remarks>
/// <returns>Returned if the request is successful.</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<AnnouncementBannerConfiguration> GetBannerAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
request_.Method = new System.Net.Http.HttpMethod("GET");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json"));
var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "rest/api/3/announcementBanner"
urlBuilder_.Append("rest/api/3/announcementBanner");
|
|
Run: Compile, Test, Pack
[xUnit.net 00:00:11.75] NSwag.CodeGeneration.CSharp.Tests.ClientGenerationTests.CanGenerateFromShipBobOpenApiSpecification [FAIL]
|
|
Run: Compile, Test, Pack
[xUnit.net 00:00:11.20] NSwag.CodeGeneration.CSharp.Tests.ClientGenerationTests.CanGenerateFromJiraOpenApiSpecification [FAIL]
|
|
Run: Compile, Test, Pack
npm warn deprecated [email protected]: For the actively supported Angular, see https://www.npmjs.com/package/@angular/core. AngularJS support has officially ended. For extended AngularJS support options, see https://goo.gle/angularjs-path-forward.
|
Loading