-
Notifications
You must be signed in to change notification settings - Fork 421
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
[Spring] Required post body with path parameters produces uncompilable code #255
Comments
I have the same issue (with swagger-codegen-maven-plugin 3.0.3) |
I had similar issue with swagger-codegen-maven-plugin 3.0.3. I see the no comma after it generated code.
|
Hi, Maybe this issue has to be generalized? I am experiencing the same issue for both csharp generators (csharp and csharp-dotnet2). Example: Request method definition: ...
"/api/v1/Device/AddUserDevice":{
"post":{
"tags":[
"Device"
],
"operationId":"Device_AddUserDevice",
"consumes":[
"application/json",
"text/json",
"application/xml",
"text/xml",
"application/x-www-form-urlencoded"
],
"produces":[
"application/json",
"text/json",
"application/xml",
"text/xml"
],
"parameters":[
{
"name":"value",
"in":"body",
"required":true,
"schema":{
"$ref":"#/definitions/DeviceModel"
}
}
],
"responses":{
"200":{
"description":"OK"
},
"400":{
"description":"BadRequest"
}
}
}
}
... Body schema definition: ...
"DeviceModel":{
"type":"object",
"properties":{
"id":{
"type":"string"
},
"created":{
"format":"date-time",
"type":"string"
},
"additionalInformation":{
"type":"string"
},
"deviceId":{
"type":"string"
},
"deviceTypeId":{
"format":"int32",
"type":"integer"
},
"userId":{
"type":"string"
},
"deviceName":{
"type":"string"
},
"controlAuthorizationLevel":{
"format":"int32",
"type":"integer"
},
"isOwnedByMe":{
"type":"boolean"
},
"isSharedToOthers":{
"type":"boolean"
}
}
}
... And the output I get for /// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IDeviceApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Api.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <param name="id"> (optional)</param>
/// <param name="created"> (optional)</param>
/// <param name="additionalInformation"> (optional)</param>
/// <param name="deviceId"> (optional)</param>
/// <param name="deviceTypeId"> (optional)</param>
/// <param name="userId"> (optional)</param>
/// <param name="deviceName"> (optional)</param>
/// <param name="controlAuthorizationLevel"> (optional)</param>
/// <param name="isOwnedByMe"> (optional)</param>
/// <param name="isSharedToOthers"> (optional)</param>
/// <returns></returns>
void DeviceAddUserDevice (DeviceModel bodystring id = null, DateTime? created = null, string additionalInformation = null, string deviceId = null, int? deviceTypeId = null, string userId = null, string deviceName = null, int? controlAuthorizationLevel = null, bool? isOwnedByMe = null, bool? isSharedToOthers = null);
... Notice the missing comma between the first and second parameter. |
it works for me if I remove
|
hello guys, this issue has been fixed with PR #267. Going to close this ticket but please let me know if there's still something wrong and i'll handle it. |
If you have a required requestBody in combination with path parameters, the body will be placed first, and there will be no comma after it in the generated codes argument list:
Attached sample openapi.yaml, invoke with:
Resulting code:
I have reformatted the code slightly to highlight the error.
openapi.txt
The text was updated successfully, but these errors were encountered: