I started to use the "Generate Optional Parameter" option
But the C Sharp client is generating duplicate methods since it is generating a method with a nulleable parameter and cancellation token nulleable and also another method with cancelation token nulleable
c# sample endpoint
[HttpGet("all")]
public async Task<ActionResult<BucketInfo[]>> GetBuckets(string prefix)
sample config.zip
c# sample code generated
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.1.3.0 (NJsonSchema v10.0.27.0 (Newtonsoft.Json v11.0.0.0))")]
public partial interface IBucketClient
{
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Return the complete list of drives</summary>
/// <returns>Returns the list of drives</returns>
/// <exception cref="GDriveSDKException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GDriveSDKResponse<System.Collections.Generic.ICollection<BucketInfo>>> AllGetAsync(string prefix = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>Get the list of owned and shared TeamDrives for the user</summary>
/// <returns>Return the list of drives</returns>
/// <exception cref="GDriveSDKException">A server side error occurred.</exception>
System.Threading.Tasks.Task<GDriveSDKResponse<System.Collections.Generic.ICollection<TeamDrive>>> AllGetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
I set the "Operation Generation Mode" with the MultipleClientsFromFirstTagAndPathSegments
Attached you can find a sample configuration that we are using
Would it be possible to eliminate the method that only receives the cancellationtoken parameter?
Any news with this issue?
I need the same requirement, please bring us some response
Can you also provide a sample swagger spec?
Sure!
"/api/bucket/allname": {
"get": {
"tags": [
"Bucket"
],
"summary": "Return the complete list of drives names",
"operationId": "GetBucketNames",
"consumes": [],
"produces": [
"application/json;odata.metadata=minimal;odata.streaming=true",
"application/json;odata.metadata=minimal;odata.streaming=false",
"application/json;odata.metadata=minimal",
"application/json;odata.metadata=full;odata.streaming=true",
"application/json;odata.metadata=full;odata.streaming=false",
"application/json;odata.metadata=full",
"application/json;odata.metadata=none;odata.streaming=true",
"application/json;odata.metadata=none;odata.streaming=false",
"application/json;odata.metadata=none",
"application/json;odata.streaming=true",
"application/json;odata.streaming=false",
"application/json",
"application/xml",
"application/prs.odatatestxx-odata",
"text/plain",
"text/json"
],
"parameters": [
{
"name": "prefix",
"in": "query",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "Returns the list of drives",
"schema": {
"uniqueItems": false,
"type": "array",
"items": {
"$ref": "#/definitions/Gdrive.Model.Storage.Drive"
}
}
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "If the user doesn't have access"
},
"401": {
"description": "Unauthorized"
}
}
}
If something else is required let me know!
Thanks!
Most helpful comment
Can you also provide a sample swagger spec?