[nancyfx/csharp] Customize interface prefix (#4557)

Per #4486, this allows user to specify the use of a standard or custom
prefix for interfaces. For C# based languages, this follows Microsoft's
Framework Design Guidelines and uses an I- prefix. However, to avoid
breaking changes with existing nancyfx generated code, the default is
unset.

The option supports true, false, or a custom prefix.
This commit is contained in:
Jim Schubert
2017-01-15 09:35:43 -06:00
committed by wing328
parent d7e6a3da6a
commit 663b471d1a
10 changed files with 45 additions and 27 deletions

View File

@@ -50,6 +50,8 @@ public class CSharpClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setGeneratePropertyChanged(true);
times = 1;
clientCodegen.setInterfacePrefix("X");
times = 1;
}};
}
}

View File

@@ -35,6 +35,7 @@ public class CSharpClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.OPTIONAL_EMIT_DEFAULT_VALUES, "true")
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.put(CodegenConstants.GENERATE_PROPERTY_CHANGED, "true")
.put(CodegenConstants.INTERFACE_PREFIX, "X")
.build();
}

View File

@@ -1,17 +1,11 @@
package io.swagger.codegen.options;
import static io.swagger.codegen.CodegenConstants.PACKAGE_NAME;
import static io.swagger.codegen.CodegenConstants.PACKAGE_VERSION;
import static io.swagger.codegen.CodegenConstants.RETURN_ICOLLECTION;
import static io.swagger.codegen.CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG;
import static io.swagger.codegen.CodegenConstants.SOURCE_FOLDER;
import static io.swagger.codegen.CodegenConstants.USE_COLLECTION;
import static io.swagger.codegen.CodegenConstants.USE_DATETIME_OFFSET;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import static io.swagger.codegen.CodegenConstants.*;
public class NancyFXServerOptionsProvider implements OptionsProvider {
public static final String PACKAGE_NAME_VALUE = "swagger_server_nancyfx";
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
@@ -32,6 +26,7 @@ public class NancyFXServerOptionsProvider implements OptionsProvider {
.put(USE_DATETIME_OFFSET, "true")
.put(USE_COLLECTION, "false")
.put(RETURN_ICOLLECTION, "false")
.put(INTERFACE_PREFIX, "X")
.build();
}