Closed JayArrowz closed 2 years ago
I think this package is not good at dealing with Swagger 2 which is already very old, and the parsing of definition filesrelies on a Microsoft package, which is apparently not caring much about Swagger 2.
I put your json file to https://editor.swagger.io/ which asks for converting to yaml (3) then SwaggerEditor reports a lot structural errors, and the function with "Fetch kyc check entity" is missing from the generated yaml file.
However, if I decline the prompt for converting to yaml 3 and go Edit/Convert to YAML
, then a YAML 3.01 file is generated, and Swagger Editor is reporting only one semantic error.
Then I use the generated yaml file and your json settings file to generate C# codes, and apparently things are looking basically find now, at least for the function in question.
/// <summary>
/// Fetch kyc check entity
/// Fetch kyc check entity
/// GET_v1CustomerEndusersEnduser_idKycChecksKyc_id v1/customer/endusers/{enduser_id}/kyc-checks/{kyc_id}
/// </summary>
public async Task GET_v1CustomerEndusersEnduser_idKycChecksKyc_idAsync(string enduser_id, string kyc_id, Action<System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
{
var requestUri = "v1/customer/endusers/"+ (enduser_id==null? "" : Uri.EscapeDataString(enduser_id))+"/kyc-checks/"+ (kyc_id==null? "" : Uri.EscapeDataString(kyc_id));
using (var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUri))
{
if (handleHeaders != null)
{
handleHeaders(httpRequestMessage.Headers);
}
var responseMessage = await client.SendAsync(httpRequestMessage);
try
{
responseMessage.EnsureSuccessStatusCodeEx();
}
finally
{
responseMessage.Dispose();
}
}
}
If you could confirm the result is basically OK, I shall add a warning in Readme.md or wiki about potential pitfall with Swagger 2.0 files.
Hi,
I am using this JSON here to generate a c# client https://api.stoplight.io/v1/versions/ubseqcNqLrs2rxxpZ/export/oas.json
However it seems like it doesn't generate the correct models. For example: This is just one endpoint here has no return value:![image](https://user-images.githubusercontent.com/49910176/122650911-5c777c00-d12d-11eb-9a47-19291da029be.png)
There any many more POSTs and GETs without return values.
Here is my settings.json:
Here is the log: