forked from loafle/openapi-generator-original
allowing user to set client package (#13785)
This commit is contained in:
parent
a68c36e932
commit
c0c31e89b7
@ -84,10 +84,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
private static FrameworkStrategy defaultFramework = FrameworkStrategy.NETSTANDARD_2_0;
|
||||
protected final Map<String, String> frameworks;
|
||||
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase(Locale.ROOT) + "}";
|
||||
protected String clientPackage = "Org.OpenAPITools.Client";
|
||||
protected String clientPackage = "Client";
|
||||
protected String authFolder = "Auth";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
protected String apiDocPath = "docs" + File.separator;
|
||||
protected String modelDocPath = "docs" + File.separator;
|
||||
|
||||
// Defines TargetFrameworkVersion in csproj files
|
||||
protected String targetFramework = defaultFramework.name;
|
||||
@ -547,6 +547,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
postProcessPattern(property.pattern, property.vendorExtensions);
|
||||
postProcessEmitDefaultValue(property.vendorExtensions);
|
||||
|
||||
// remove once https://github.com/OpenAPITools/openapi-generator/pull/13681 is merged
|
||||
if (GENERICHOST.equals(getLibrary())) {
|
||||
// all c# libraries should want this, but avoid breaking changes for now
|
||||
// a class cannot contain a property with the same name
|
||||
@ -664,8 +665,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
setModelPackage("Model");
|
||||
}
|
||||
|
||||
clientPackage = "Client";
|
||||
|
||||
if (GENERICHOST.equals(getLibrary())) {
|
||||
setLibrary(GENERICHOST);
|
||||
additionalProperties.put("useGenericHost", true);
|
||||
@ -679,7 +678,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
additionalProperties.put("useHttpClient", true);
|
||||
needsUriBuilder = true;
|
||||
} else {
|
||||
throw new RuntimeException("Invalid HTTP library " + getLibrary() + ". Only restsharp, httpclient are supported.");
|
||||
throw new RuntimeException("Invalid HTTP library " + getLibrary() + ". Only restsharp, httpclient, and generichost are supported.");
|
||||
}
|
||||
|
||||
String inputFramework = (String) additionalProperties.getOrDefault(CodegenConstants.DOTNET_FRAMEWORK, defaultFramework.name);
|
||||
@ -742,7 +741,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
final AtomicReference<Boolean> excludeTests = new AtomicReference<>();
|
||||
syncBooleanProperty(additionalProperties, CodegenConstants.EXCLUDE_TESTS, excludeTests::set, false);
|
||||
|
||||
syncStringProperty(additionalProperties, "clientPackage", (s) -> { }, clientPackage);
|
||||
syncStringProperty(additionalProperties, "clientPackage", this::setClientPackage, clientPackage);
|
||||
|
||||
syncStringProperty(additionalProperties, CodegenConstants.API_PACKAGE, this::setApiPackage, apiPackage);
|
||||
syncStringProperty(additionalProperties, CodegenConstants.MODEL_PACKAGE, this::setModelPackage, modelPackage);
|
||||
@ -809,6 +808,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
addTestInstructions();
|
||||
}
|
||||
|
||||
public void setClientPackage(String clientPackage) {
|
||||
this.clientPackage = clientPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
|
Loading…
x
Reference in New Issue
Block a user