[csharp] clean boolean additional properties 6784 (#6899)

* [csharp] Convert "false" properties to booleans

It appears as though "false" strings in additionalProperties are no
longer treated as false booleans. This may be an issue elsewhere, but a
simple fix is to always explicitly set the boolean value in a generator
class back to the additionalProperties map to convert boolean Strings to
boolean Objects.

* [nancyfx] Clean up async default option handling

* [nancyfx] Include asyncServer=false in sample script

* [csharp] Regenerate samples

* [csharp] Resolve .net 4 generation issues

Some functionality is missing from .NET 4.0, such as IReadonlyDictionary
and Type.GetTypeInfo().

This commit resolves compilation of generated .NET 4.0 code, requiring
no conditional versioning of Newtonsoft.Json.

* [csharp] Regenerate .net 4.0 sample

* [csharp] Resolve .NET 4.0 sample compile

Sample build.sh wasn't accounting for targeting different FCL correctly.
That is, when passing "net40" to the -sdk option, it would use the
default -sdk:4 and -langversion:6. These don't necessarily match with
what is installed on a machine with only .NET 4.0 (which is our targeted
use case here).

To resolve, we need to define another version-specific value for passing
to the mcs -sdk option (see man mcs for details).

This option currently isn't overridable in the client codegen class.
Also, langversion is set specifically to the version of C# available to
the targeted SDK version. If there is need, we may extend this to
something like:

langversion=${MCS_LANG_VERSION:-6}

To allow users to run as:

   env MCS_LANG_VERSION=5 sh build.sh

I haven't done this because I doubt there's much of a use case via this
script. I'm assuming most consumers will build via IDE or MSBuild.

* [csharp] Revert bin/csharp-petstore.sh to 3.5

* [csharp] Regenerate .NET 3.5 sample

* [csharp] Resolve nuget issue with existing files

* [csharp] Update -all.sh, regenerate samples
This commit is contained in:
Jim Schubert
2017-11-15 09:36:37 -05:00
committed by William Cheng
parent 970de01bdf
commit 2c9f98ce38
69 changed files with 3455 additions and 270 deletions

View File

@@ -183,6 +183,9 @@ public class CodegenConstants {
public static final String SUPPORTS_ES6 = "supportsES6";
public static final String SUPPORTS_ES6_DESC = "Generate code that conforms to ES6.";
public static final String SUPPORTS_ASYNC = "supportsAsync";
public static final String SUPPORTS_ASYNC_DESC = "Generate code that supports async operations.";
public static final String EXCLUDE_TESTS = "excludeTests";
public static final String EXCLUDE_TESTS_DESC = "Specifies that no tests are to be generated.";
@@ -207,6 +210,9 @@ public class CodegenConstants {
public static final String NON_PUBLIC_API = "nonPublicApi";
public static final String NON_PUBLIC_API_DESC = "Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.";
public static final String VALIDATABLE = "validatable";
public static final String VALIDATABLE_DESC = "Generates self-validatable models.";
public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride";
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation.";

View File

@@ -263,24 +263,33 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// {{useDateTimeOffset}}
if (additionalProperties.containsKey(CodegenConstants.USE_DATETIME_OFFSET)) {
useDateTimeOffset(Boolean.valueOf(additionalProperties.get(CodegenConstants.USE_DATETIME_OFFSET).toString()));
useDateTimeOffset(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_DATETIME_OFFSET));
} else {
additionalProperties.put(CodegenConstants.USE_DATETIME_OFFSET, useDateTimeOffsetFlag);
}
additionalProperties.put(CodegenConstants.USE_DATETIME_OFFSET, useDateTimeOffsetFlag);
if (additionalProperties.containsKey(CodegenConstants.USE_COLLECTION)) {
setUseCollection(Boolean.valueOf(additionalProperties.get(CodegenConstants.USE_COLLECTION).toString()));
setUseCollection(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_COLLECTION));
} else {
additionalProperties.put(CodegenConstants.USE_COLLECTION, useCollection);
}
if (additionalProperties.containsKey(CodegenConstants.RETURN_ICOLLECTION)) {
setReturnICollection(Boolean.valueOf(additionalProperties.get(CodegenConstants.RETURN_ICOLLECTION).toString()));
setReturnICollection(convertPropertyToBooleanAndWriteBack(CodegenConstants.RETURN_ICOLLECTION));
} else {
additionalProperties.put(CodegenConstants.RETURN_ICOLLECTION, returnICollection);
}
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES)) {
setOptionalEmitDefaultValue(Boolean.valueOf(additionalProperties.get(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES).toString()));
setOptionalEmitDefaultValue(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES));
} else {
additionalProperties.put(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES, optionalEmitDefaultValue);
}
if (additionalProperties.containsKey(CodegenConstants.NETCORE_PROJECT_FILE)) {
setNetCoreProjectFileFlag(Boolean.valueOf(additionalProperties.get(CodegenConstants.NETCORE_PROJECT_FILE).toString()));
setNetCoreProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.NETCORE_PROJECT_FILE));
} else {
additionalProperties.put(CodegenConstants.NETCORE_PROJECT_FILE, netCoreProjectFileFlag);
}
if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) {

View File

@@ -1,5 +1,6 @@
package io.swagger.codegen.languages;
import com.samskivert.mustache.Mustache;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.CodegenOperation;
import io.swagger.codegen.CodegenType;
@@ -169,4 +170,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
// Converts, for example, PUT to HttpPut for controller attributes
operation.httpMethod = "Http" + operation.httpMethod.substring(0, 1) + operation.httpMethod.substring(1).toLowerCase();
}
@Override
public Mustache.Compiler processCompiler(Mustache.Compiler compiler) {
// To avoid unexpected behaviors when options are passed programmatically such as { "useCollection": "" }
return super.processCompiler(compiler).emptyStringIsFalse(true);
}
}

View File

@@ -1,6 +1,7 @@
package io.swagger.codegen.languages;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import io.swagger.codegen.*;
import io.swagger.models.Model;
import org.slf4j.Logger;
@@ -17,21 +18,33 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
private static final String NET45 = "v4.5";
private static final String NET40 = "v4.0";
private static final String NET35 = "v3.5";
// TODO: v5.0 is PCL, not netstandard version 1.3, and not a specific .NET Framework. This needs to be updated,
// especially because it will conflict with .NET Framework 5.0 when released, and PCL 5 refers to Framework 4.0.
// We should support either NETSTANDARD, PCL, or Both… but the concepts shouldn't be mixed.
private static final String NETSTANDARD = "v5.0";
private static final String UWP = "uwp";
// Defines the sdk option for targeted frameworks, which differs from targetFramework and targetFrameworkNuget
private static final String MCS_NET_VERSION_KEY = "x-mcs-sdk";
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase() + "}";
protected String clientPackage = "IO.Swagger.Client";
protected String localVariablePrefix = "";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
// Defines TargetFrameworkVersion in csproj files
protected String targetFramework = NET45;
// Defines nuget identifiers for target framework
protected String targetFrameworkNuget = "net45";
protected boolean supportsAsync = Boolean.TRUE;
protected boolean supportsUWP = Boolean.FALSE;
protected boolean netStandard = Boolean.FALSE;
protected boolean generatePropertyChanged = Boolean.FALSE;
protected boolean hideGenerationTimestamp = Boolean.TRUE;
protected boolean validatable = Boolean.TRUE;
protected Map<Character, String> regexModifiers;
protected final Map<String, String> frameworks;
@@ -145,6 +158,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
CodegenConstants.NETCORE_PROJECT_FILE_DESC,
this.netCoreProjectFileFlag);
addSwitch(CodegenConstants.VALIDATABLE,
CodegenConstants.VALIDATABLE_DESC,
this.validatable);
regexModifiers = new HashMap<Character, String>();
regexModifiers.put('i', "IgnoreCase");
regexModifiers.put('m', "Multiline");
@@ -156,39 +173,43 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
public void processOpts() {
super.processOpts();
/*
* NOTE: When supporting boolean additionalProperties, you should read the value and write it back as a boolean.
* This avoids oddities where additionalProperties contains "false" rather than false, which will cause the
* templating engine to behave unexpectedly.
*
* Use the pattern:
* if (additionalProperties.containsKey(prop)) convertPropertyToBooleanAndWriteBack(prop);
*/
if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) {
setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING));
}
// default HIDE_GENERATION_TIMESTAMP to true
if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString());
if (additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
setHideGenerationTimestamp(convertPropertyToBooleanAndWriteBack(CodegenConstants.HIDE_GENERATION_TIMESTAMP));
} else {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
Boolean.valueOf(additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP).toString()));
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, hideGenerationTimestamp);
}
if (isEmpty(apiPackage)) {
apiPackage = "Api";
setApiPackage("Api");
}
if (isEmpty(modelPackage)) {
modelPackage = "Model";
setModelPackage("Model");
}
clientPackage = "Client";
Boolean excludeTests = false;
if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) {
excludeTests = Boolean.valueOf(additionalProperties.get(CodegenConstants.EXCLUDE_TESTS).toString());
excludeTests = convertPropertyToBooleanAndWriteBack(CodegenConstants.EXCLUDE_TESTS);
}
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
additionalProperties.put("clientPackage", clientPackage);
additionalProperties.put("emitDefaultValue", optionalEmitDefaultValue);
if (!additionalProperties.containsKey("validatable")) {
// default validatable to true if not set
additionalProperties.put("validatable", true);
if (additionalProperties.containsKey(CodegenConstants.VALIDATABLE)) {
setValidatable(convertPropertyToBooleanAndWriteBack(CodegenConstants.VALIDATABLE));
} else {
additionalProperties.put(CodegenConstants.VALIDATABLE, validatable);
}
if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) {
@@ -196,93 +217,116 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
} else {
// Ensure default is set.
setTargetFramework(NET45);
additionalProperties.put("targetFramework", this.targetFramework);
additionalProperties.put(CodegenConstants.DOTNET_FRAMEWORK, this.targetFramework);
}
if (NET35.equals(this.targetFramework)) {
setTargetFrameworkNuget("net35");
setSupportsAsync(Boolean.FALSE);
if (additionalProperties.containsKey("supportsAsync")) {
additionalProperties.remove("supportsAsync");
}
additionalProperties.put("validatable", false);
// This is correct, mono will require you build .NET 3.5 sources using 4.0 SDK
additionalProperties.put(MCS_NET_VERSION_KEY, "4");
additionalProperties.put("net35", true);
if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ASYNC)) {
LOGGER.warn(".NET 3.5 generator does not support async.");
additionalProperties.remove(CodegenConstants.SUPPORTS_ASYNC);
}
setTargetFrameworkNuget("net35");
setValidatable(Boolean.FALSE);
setSupportsAsync(Boolean.FALSE);
} else if (NETSTANDARD.equals(this.targetFramework)) {
// TODO: NETSTANDARD here is misrepresenting a PCL v5.0 which supports .NET Framework 4.6+, .NET Core 1.0, and Windows Universal 10.0
additionalProperties.put(MCS_NET_VERSION_KEY, "4.6-api");
if (additionalProperties.containsKey("supportsUWP")) {
LOGGER.warn(".NET " + NETSTANDARD + " generator does not support UWP.");
additionalProperties.remove("supportsUWP");
}
// TODO: NETSTANDARD=v5.0 and targetFrameworkNuget=netstandard1.3. These need to sync.
setTargetFrameworkNuget("netstandard1.3");
setSupportsAsync(Boolean.TRUE);
setSupportsUWP(Boolean.FALSE);
setNetStandard(Boolean.TRUE);
additionalProperties.put("supportsAsync", this.supportsAsync);
additionalProperties.put("supportsUWP", this.supportsUWP);
additionalProperties.put("netStandard", this.netStandard);
//Tests not yet implemented for .NET Standard codegen
//Todo implement it
excludeTests = true;
if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) {
additionalProperties.remove(CodegenConstants.EXCLUDE_TESTS);
}
additionalProperties.put(CodegenConstants.EXCLUDE_TESTS, excludeTests);
} else if (UWP.equals(this.targetFramework)) {
setTargetFrameworkNuget("uwp");
setSupportsAsync(Boolean.TRUE);
setSupportsUWP(Boolean.TRUE);
additionalProperties.put("supportsAsync", this.supportsAsync);
additionalProperties.put("supportsUWP", this.supportsUWP);
} else if (NET40.equals(this.targetFramework)) {
additionalProperties.put(MCS_NET_VERSION_KEY, "4");
additionalProperties.put("isNet40", true);
if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ASYNC)) {
LOGGER.warn(".NET " + NET40 + " generator does not support async.");
additionalProperties.remove(CodegenConstants.SUPPORTS_ASYNC);
}
setTargetFrameworkNuget("net40");
setSupportsAsync(Boolean.FALSE);
if (additionalProperties.containsKey("supportsAsync")) {
additionalProperties.remove("supportsAsync");
}
additionalProperties.put("isNet40", true);
} else {
additionalProperties.put(MCS_NET_VERSION_KEY, "4.5.2-api");
setTargetFrameworkNuget("net45");
setSupportsAsync(Boolean.TRUE);
additionalProperties.put("supportsAsync", this.supportsAsync);
}
if (additionalProperties.containsKey(CodegenConstants.GENERATE_PROPERTY_CHANGED)) {
if (NET35.equals(targetFramework)) {
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is only supported by generated code for .NET 4+.");
additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED);
} else if (NETSTANDARD.equals(targetFramework)) {
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in .NET Standard generated code.");
additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED);
} else if (Boolean.TRUE.equals(netCoreProjectFileFlag)) {
LOGGER.warn(CodegenConstants.GENERATE_PROPERTY_CHANGED + " is not supported in .NET Core csproj project format.");
} else {
setGeneratePropertyChanged(Boolean.valueOf(additionalProperties.get(CodegenConstants.GENERATE_PROPERTY_CHANGED).toString()));
}
if (Boolean.FALSE.equals(this.generatePropertyChanged)) {
additionalProperties.remove(CodegenConstants.GENERATE_PROPERTY_CHANGED);
} else {
setGeneratePropertyChanged(convertPropertyToBooleanAndWriteBack(CodegenConstants.GENERATE_PROPERTY_CHANGED));
}
}
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage);
additionalProperties.put("clientPackage", clientPackage);
additionalProperties.put(CodegenConstants.EXCLUDE_TESTS, excludeTests);
additionalProperties.put(CodegenConstants.VALIDATABLE, this.validatable);
additionalProperties.put(CodegenConstants.SUPPORTS_ASYNC, this.supportsAsync);
additionalProperties.put("supportsUWP", this.supportsUWP);
additionalProperties.put("netStandard", this.netStandard);
additionalProperties.put("targetFrameworkNuget", this.targetFrameworkNuget);
// TODO: either remove this and update templates to match the "optionalEmitDefaultValues" property, or rename that property.
additionalProperties.put("emitDefaultValue", optionalEmitDefaultValue);
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) {
setOptionalProjectFileFlag(Boolean.valueOf(
additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_FILE).toString()));
setOptionalProjectFileFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_PROJECT_FILE));
} else {
additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_FILE, optionalProjectFileFlag);
}
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_GUID)) {
setPackageGuid((String) additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_GUID));
} else {
additionalProperties.put(CodegenConstants.OPTIONAL_PROJECT_GUID, packageGuid);
}
additionalProperties.put("packageGuid", packageGuid);
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_METHOD_ARGUMENT)) {
setOptionalMethodArgumentFlag(Boolean.valueOf(additionalProperties
.get(CodegenConstants.OPTIONAL_METHOD_ARGUMENT).toString()));
setOptionalMethodArgumentFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_METHOD_ARGUMENT));
} else {
additionalProperties.put(CodegenConstants.OPTIONAL_METHOD_ARGUMENT, optionalMethodArgumentFlag);
}
additionalProperties.put("optionalMethodArgument", optionalMethodArgumentFlag);
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_ASSEMBLY_INFO)) {
setOptionalAssemblyInfoFlag(Boolean.valueOf(additionalProperties
.get(CodegenConstants.OPTIONAL_ASSEMBLY_INFO).toString()));
setOptionalAssemblyInfoFlag(convertPropertyToBooleanAndWriteBack(CodegenConstants.OPTIONAL_ASSEMBLY_INFO));
} else {
additionalProperties.put(CodegenConstants.OPTIONAL_ASSEMBLY_INFO, optionalAssemblyInfoFlag);
}
if (additionalProperties.containsKey(CodegenConstants.NON_PUBLIC_API)) {
setNonPublicApi(Boolean.valueOf(additionalProperties.get(CodegenConstants.NON_PUBLIC_API).toString()));
setNonPublicApi(convertPropertyToBooleanAndWriteBack(CodegenConstants.NON_PUBLIC_API));
} else {
additionalProperties.put(CodegenConstants.NON_PUBLIC_API, isNonPublicApi());
}
final String testPackageName = testPackageName();
@@ -318,6 +362,12 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("JsonSubTypes.mustache",
clientPackageDir, "JsonSubTypes.cs"));
if (NET40.equals(this.targetFramework)) {
// .net 4.0 doesn't include ReadOnlyDictionary…
supportingFiles.add(new SupportingFile("ReadOnlyDictionary.mustache",
clientPackageDir, "ReadOnlyDictionary.cs"));
}
if (Boolean.FALSE.equals(this.netStandard) && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh"));
@@ -346,6 +396,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
if (Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("packages_test.config.mustache", testPackageFolder + File.separator, "packages.config"));
}
if (NET40.equals(this.targetFramework)) {
// Include minimal tests for modifications made to JsonSubTypes, since code is quite different for .net 4.0 from original implementation
supportingFiles.add(new SupportingFile("JsonSubTypesTests.mustache",
testPackageFolder + File.separator + "Client",
"JsonSubTypesTests.cs"));
}
}
if (Boolean.TRUE.equals(generatePropertyChanged)) {
@@ -355,9 +412,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
// apache v2 license
// UPDATE (20160612) no longer needed as the Apache v2 LICENSE is added globally
//supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
if (optionalAssemblyInfoFlag && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) {
supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs"));
@@ -727,6 +781,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
this.generatePropertyChanged = generatePropertyChanged;
}
public void setHideGenerationTimestamp(boolean hideGenerationTimestamp) {
this.hideGenerationTimestamp = hideGenerationTimestamp;
}
public boolean isNonPublicApi() {
return nonPublicApi;
}
@@ -735,6 +793,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
this.nonPublicApi = nonPublicApi;
}
public void setValidatable(boolean validatable) {
this.validatable = validatable;
}
@Override
public String toModelDocFilename(String name) {
return toModelFilename(name);
@@ -759,4 +821,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
public String modelTestFileFolder() {
return outputFolder + File.separator + testFolder + File.separator + testPackageName() + File.separator + modelPackage();
}
@Override
public Mustache.Compiler processCompiler(Mustache.Compiler compiler) {
// To avoid unexpected behaviors when options are passed programmatically such as { "supportsAsync": "" }
return super.processCompiler(compiler).emptyStringIsFalse(true);
}
}

View File

@@ -91,7 +91,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
addSwitch(RETURN_ICOLLECTION, RETURN_ICOLLECTION_DESC, returnICollection);
addSwitch(IMMUTABLE_OPTION, "Enabled by default. If disabled generates model classes with setters", true);
addSwitch(USE_BASE_PATH, "Enabled by default. If disabled, module paths will not mirror api base path", true);
addSwitch(ASYNC_SERVER, "Set to true to enable the generation of async routes/endpoints.", false);
addSwitch(ASYNC_SERVER, "Set to true to enable the generation of async routes/endpoints.", this.asyncServer);
typeMapping.putAll(nodaTimeTypesMappings());
languageSpecificPrimitives.addAll(nodaTimePrimitiveTypes());
@@ -134,7 +134,9 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen {
}
if (additionalProperties.containsKey(ASYNC_SERVER)) {
setAsyncServer(Boolean.valueOf(additionalProperties.get(ASYNC_SERVER).toString()));
setAsyncServer(convertPropertyToBooleanAndWriteBack(ASYNC_SERVER));
} else {
additionalProperties.put(ASYNC_SERVER, this.asyncServer);
}
additionalProperties.put("packageGuid", packageGuid);