Closed taori closed 10 months ago
is this with the latest preview packages?
Yes. the latest i could get on saturday at least
@paulomorgado is this related to your change?
How can we repro this, @taori?
I simply picked some swagger definition and generated a client from that. That constructor is being generated. Once i used it, i noticed it does not work as expected
@taori, can you, please, provide a simple swagger definition and what were you expecting from the 14 generator and failed and how?
We need concrete examples for the investigation.
I'm having the same problem, it can be reproduced using this sample open api: https://petstore.swagger.io/v2/swagger.json, my config
var settings = new CSharpClientGeneratorSettings
{
GenerateClientClasses = true,
GenerateOptionalParameters = true,
ClassName = "{controller}Client",
OperationNameGenerator = operationNameGenerator, //failing with both MultipleClientsFromFirstTagAndOperationNameGenerator and SingleClientFromOperationIdOperationNameGenerator
CSharpGeneratorSettings =
{
Namespace = "someCustomNamespace",
JsonLibrary = CSharpJsonLibrary.SystemTextJson,
ClassStyle = CSharpClassStyle.Poco,
},
UseHttpClientCreationMethod = false,
DisposeHttpClient = true,
GenerateSyncMethods = false,
GeneratePrepareRequestAndProcessResponseAsAsyncMethods = false,
};
edit: actually my problem seems to be different in version 13 the url was initialized like this
private string _baseUrl = "https://petstore.swagger.io/v2";
now its:
#pragma warning disable 8618 // Set by constructor via BaseUrl property
private string _baseUrl;
#pragma restore disable 8618 // Set by constructor via BaseUrl property
but it is not set in the constructor or anywhere else
I think I have a working solution at #4691, but I need to do more tests.
In the meantime, I'd appreciate if someone could test the template in the PR.
This is a generated client:
The generated client should use the property setter to set the BaseUrl property, or the reader should add a trailing slash so the address is correct.
Obviously i can just fix this on my end myself but i thought i'd report it.