forked from loafle/openapi-generator-original
adding extra nodeClientOptions
This commit is contained in:
parent
28f444e808
commit
c91f23c2ca
@ -7,7 +7,9 @@ import java.io.File;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
import io.swagger.codegen.SupportingFile;
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
|
|
||||||
public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen {
|
public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class);
|
||||||
@ -22,15 +24,17 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
protected String npmVersion = "1.0.0";
|
protected String npmVersion = "1.0.0";
|
||||||
protected String npmRepository = null;
|
protected String npmRepository = null;
|
||||||
|
|
||||||
@Override
|
public TypeScriptNodeClientCodegen() {
|
||||||
public String getName() {
|
super();
|
||||||
return "typescript-node";
|
outputFolder = "generated-code/typescript-node";
|
||||||
|
embeddedTemplateDir = templateDir = "typescript-node";
|
||||||
|
|
||||||
|
this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package"));
|
||||||
|
this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package"));
|
||||||
|
this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json"));
|
||||||
|
this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHelp() {
|
|
||||||
return "Generates a TypeScript nodejs client library.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
@ -74,12 +78,17 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
return indexPackage.replace('.', File.separatorChar);
|
return indexPackage.replace('.', File.separatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeScriptNodeClientCodegen() {
|
@Override
|
||||||
super();
|
public String getName() {
|
||||||
outputFolder = "generated-code/typescript-node";
|
return "typescript-node";
|
||||||
embeddedTemplateDir = templateDir = "typescript-node";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a TypeScript nodejs client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setNpmName(String npmName) {
|
public void setNpmName(String npmName) {
|
||||||
this.npmName = npmName;
|
this.npmName = npmName;
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen;
|
|||||||
public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider {
|
public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider {
|
||||||
public static final String SORT_PARAMS_VALUE = "false";
|
public static final String SORT_PARAMS_VALUE = "false";
|
||||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||||
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
private static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
||||||
public static final String NMP_NAME = "npmName";
|
private static final String NMP_NAME = "npmName";
|
||||||
private static final String NMP_VERSION = "1.1.2";
|
private static final String NMP_VERSION = "1.1.2";
|
||||||
private static final String NPM_REPOSITORY = "https://registry.npmjs.org";
|
private static final String NPM_REPOSITORY = "https://registry.npmjs.org";
|
||||||
|
|
||||||
|
@ -1,16 +1,22 @@
|
|||||||
package io.swagger.codegen.options;
|
package io.swagger.codegen.options;
|
||||||
|
|
||||||
import io.swagger.codegen.CodegenConstants;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConstants;
|
||||||
|
import io.swagger.codegen.languages.TypeScriptAngular2ClientCodegen;
|
||||||
|
|
||||||
|
|
||||||
public class TypeScriptNodeClientOptionsProvider implements OptionsProvider {
|
public class TypeScriptNodeClientOptionsProvider implements OptionsProvider {
|
||||||
public static final String SORT_PARAMS_VALUE = "false";
|
public static final String SORT_PARAMS_VALUE = "false";
|
||||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||||
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
public static final String MODEL_PROPERTY_NAMING_VALUE = "camelCase";
|
||||||
|
|
||||||
|
private static final String NMP_NAME = "npmName";
|
||||||
|
private static final String NMP_VERSION = "1.1.2";
|
||||||
|
private static final String NPM_REPOSITORY = "https://registry.npmjs.org";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
return "typescript-node";
|
return "typescript-node";
|
||||||
@ -22,6 +28,10 @@ public class TypeScriptNodeClientOptionsProvider implements OptionsProvider {
|
|||||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||||
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
.put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE)
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.NPM_NAME, NMP_NAME)
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.NPM_VERSION, NMP_VERSION)
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString())
|
||||||
|
.put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user