Reputation: 1
I have the following section in swagger:
"/api/configuration/person": {
"get": {
"tags": [
"PersonInformation"
],
"summary": " (Auth policies: Reader)",
"operationId": "GetPersonInformation",
"parameters": [
{
"name": "lastname",
"in": "query",
"description": "'lastname' is optional parameter.",
"allowEmptyValue": true,
"required": false,
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "api-version",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GetPersonInformation"
}
}
}
}
},
"400": {
"description": "Bad Request"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Server Error"
}
}
}
},
This swagger comes from the API definition:
[HttpGet]
[Authorize(Policy = "Reader")]
[Route("configuration/drops", Name = nameof(GetPersonInformation))]
[SwaggerResponse(StatusCodes.Status200OK, type: typeof(IEnumerable<PersonInformation>))]
[SwaggerResponse(StatusCodes.Status400BadRequest)]
[SwaggerResponse(StatusCodes.Status404NotFound)]
[SwaggerResponse(StatusCodes.Status500InternalServerError)]
public async Task\<IActionResult\> GetPersonInformation(
CancellationToken cancellationToken,
string lastname = null)
I ran autorest with parameters: autorest --input-file=swagger.json --csharp --add-credentials --verbose
AutoRest code generation utility \[cli version: 3.7.1; node: v18.18.0\]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info | AutoRest core version selected from configuration: ^3.2.0.
info | Loading AutoRest core '.autorest@[email protected]\nodemodules@autorest\core\dist' (3.9.7)
The result is this:
public virtual async Task\<Response\> GetPersonInformation(string lastname, RequestContext context)
I expected (in previous version was correctly generated):
public virtual async Task\<Response\> GetPersonInformation(string lastname = null, RequestContext context = null)
Does anyone have a suggestion? What am I missing? Thank you!
Upvotes: 0
Views: 71